Question

I have to create a project management application in VB.Net Framework 4 which should create a client folder in a public folder in Exchange server.

I think the only way to create a public folder is through the management console. Is there a way to connect to the Exchange server and execute the creation command file from the code but I do not know how.

Is there another way?

Était-ce utile?

La solution

If you are on Exchange Service 2007 or higher you can easily create folders using the Exchange Web Services (EWS). EWS are a set of SOAP services exposed by Exchange Service making it fairly easy to do a number of different tasks on Exchange programmatically.

The easiest way to call EWS is through the Exchange Web Service Managed API which is a .NET wrapper for calling EWS from a .NET client.

When using EWS through the managed API you start by connecting to your Exchange Server. The endpoint of EWS is usually located at the address "/EWS/exchange.asmx" as show below:

var service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
service.Url = new Uri("https://server/EWS/exchange.asmx");
service.Credentials = new NetworkCredential("username", "password", "domain");

You might also use autodiscovery to connect to the server.

After having successfully connected, you can create a public folder in the following way (see also MSDN):

var folder = new Folder(service);
folder.DisplayName = "New Folder";
folder.Save(WellKnownFolderName.PublicFoldersRoot);

I know you tagged your question as VB.NET but please forgive my C# code examples.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top