Microsoft KB Archive/310279

= How to create an Outlook Calendar folder on a computer that is running Exchange 2000 Server by using Visual C# =

Article ID: 310279

Article Last Modified on 12/11/2006

-

APPLIES TO


 * Microsoft Visual C# 2005
 * Microsoft Visual C# .NET 2003 Standard Edition
 * Microsoft Visual C# .NET 2002 Standard Edition
 * Microsoft Exchange 2000 Server Standard Edition
 * Microsoft XML Core Services 4.0

-



This article was previously published under Q310279



SUMMARY
This article describes how to use Microsoft XML 3.0 to create a Microsoft Outlook Calendar folder on a computer that is running Microsoft Exchange 2000 Server by using Microsoft Visual C#.



MORE INFORMATION
To use Microsoft XML 3.0 to create an Outlook Calendar folder, follow these steps:  Start Microsoft Visual Studio .NET or Microsoft Visual Studio 2005. On the File menu, point to New, and then click Project. In the Visual C# Projects types list, click Console Application.

In Visual Studio .NET, Class1.cs is created by default. In Visual Studio 2005, Program.cs is created by default.

Note In Visual Studio 2005, click Visual C#, and then click Console Application. Add a reference to Microsoft XML 3.0. To do so, follow these steps:  On the Project menu, click Add Reference. Click the COM tab, locate Microsoft XML v3.0, and then click Select.

Note In Visual Studio 2005, you do not have to click Select. In the Add References dialog box, click OK.</li> If you are prompted to generate wrappers for the libraries that you selected, click Yes.</li></ol> </li>  In the code window, replace the code with the following: using System;

namespace WebDav {   class Class1 {          public static void Main(String [] args) {           try {                      MSXML2.XMLHTTP30 oXMLHttp = new MSXML2.XMLHTTP30; // TODO: Replace with your new folder URL String sUrl = &quot;http://ExchServer/public/MyApplication/NewFolder&quot;; // TODO: Replace the account and password oXMLHttp.open(&quot;MKCOL&quot;, sUrl, false, @&quot;UserDomain\UserAlias&quot;, &quot;UserPassword&quot;);

String sQuery;

sQuery = &quot;<?xml version='1.0'?>&quot; + &quot;<a:propertyupdate xmlns:a='DAV:' &quot; + &quot;xmlns:ex='http://schemas.microsoft.com/exchange/'>&quot; + &quot;<a:set><a:prop>&quot; + &quot;<ex:outlookfolderclass>IPF.Appointment</ex:outlookfolderclass>&quot; + &quot;</a:prop></a:set>&quot; + &quot;</a:propertyupdate>&quot;;

oXMLHttp.setRequestHeader(&quot;Content-Type&quot;, &quot;text/xml&quot;); Console.WriteLine(sQuery.Length); oXMLHttp.send(sQuery);

Console.WriteLine(oXMLHttp.status); Console.WriteLine(oXMLHttp.statusText); Console.WriteLine(oXMLHttp.responseText); }           catch (Exception e)            { Console.WriteLine(&quot;{0} Exception caught.&quot;, e); }

}        } }                    </li> Search for TODO in the code, and then modify the code for your environment.</li> Press F5 to build and to run the program.</li> Make sure that the folder was created.</li></ol>

Additional query words: create Outlook calendar folders Exchange Server

Keywords: kbmsg kbcode kbxml kbhowtomaster KB310279

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.