Welcome to MSDN Blogs Sign in | Join | Help

News

  • <font color="WHITE">Le Café Central de DeVa</font> DeVa rocks

    Bookmark and Share Bookmark and Share

    I changed the way of blogging, re-designed along with Windows 7 launch!!
    Additionally added feature, so that you can try to view the page in your language (any one of them)


    Translate into your language

    My XBOX Live

    XBox Live

    Disclaimer:

    This weblog/blog is solely my opinion.The information in this weblog/blog is provided "AS IS" with no warranties, and confers no rights. This weblog/blog does not represent the thoughts, intentions, plans or strategies of my employer. Inappropriate comments will be deleted at the authors discretion.

    Use of included script samples are subject to the terms specified in theTerms of Use

    .

    Privacy Statement:
    I do not collect personal data associated with comments posted to this site.


    Comments:
    We would like to hear your comments, reviews & valuable constructive opinion....


    Site Statistics
    Locations of visitors to this page





    Make a difference


    Subscription offer


    Developer resources



    Students free software

    Try & Test Drive Online

    More about Windows 7



    Experiences

    Go Green!!




CDOEXM & C#.Net : How to mail-disable public folders in Exchange Server 2003 SP2 – Native Mode?

I created this code snippet, which helps us to mail-disable in the Exchange Server 2003 SP2 (Native mode) – public folders. For this i tried this, i used C#.Net & CDOEXM. In this below code, i try to mail-disable the public folder named “publicfolder1”. I used Visual Studio.Net 2008, C#.Net and CDOEXM – Collaboration Data Objects for Exchange Management – 2003 to do this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CDO;
using CDOEXM;
using System.Collections; 
namespace MailDisableCSharp
{
    class Program
    {
        static void Main(string[] args)
        { 
 
            try
            {
                CDO.Folder objFolder = new CDO.Folder();
                CDOEXM.IMailRecipient objRecip;
                string fullurl;
                fullurl = "http://domain/public/publicfolder1";
 
                objFolder.DataSource.Open(
                                fullurl,
                                null,
                                ADODB.ConnectModeEnum.adModeReadWrite,
                                ADODB.RecordCreateOptionsEnum.adFailIfNotExists,
                                ADODB.RecordOpenOptionsEnum.adOpenExecuteCommand,
                                "Administrator",
                                "Password"); 
 
                objRecip = (CDOEXM.IMailRecipient)objFolder;
                objRecip.MailDisable();
                objFolder.DataSource.Save();
                Console.Write("Success");
             }
            catch (Exception e1)
            {
                Console.WriteLine(e1.Message);
           } 
 
        }
    }
}

Note:

+ To execute this code, you may try with VS.Net 2005 or VS.Net 2008, C#.Net.
+ Make sure you need to use the following references: CDOEXM – Microsoft CDO for Exchange Management 2000 & CDOEX - Microsoft CDO for Exchange 2000.
+ This code helps us to mail-disable the public folder “public folder1”.
+ Also we need to make sure to pass valid credentials username(Administrator) & password(Password) to execute this, along with valid fullURL – the public folder needs to be mail-disabled & domain – exchange domain.

Hope this helps. Happy programming!!

Posted: Wednesday, July 01, 2009 5:42 PM by Deva Gnanam .J

Comments

No Comments

New Comments to this post are disabled
Page view tracker