Access to Outlook's Public Folders: Java or C# -
i know programming language (java or c#) can used better access public folder microsoft outlook. new outlook , have done researches access outlook. and, have found c# used compared java. moreover, of apis not free use. there tutorial guides each programming language can follow , develop application? there open source libraries used?
these things want develop:
- access public folders
- view available folders
- get data files folders
i grateful precious help! =)
in .net (c#, etc) can use exchange webservices apis access public folders adding nuget package microsoft exchange webservices
application.
you'll need instance of micrtosoft.exchange.webservices.data.exchangeservice
work with, plus valid login server - passed in system.net.networkcredential
. instance:
exchangeservice exchange = new exchangeservice(); service.autodiscoverurl("myemail@mycompany.com"); service.credentials = new networkcredential("myemail", "mypassword", "mydomain");
once have that, public folders can searched using this:
public folder getfolder(string path) { folderview fview = new folderview(100); fview.propertyset = new propertyset(basepropertyset.idonly); fview.propertyset.add(folderschema.displayname); fview.traversal = foldertraversal.shallow; searchfilter filter = new searchfilter.containssubstring(folderschema.displayname, path); var fldrs = exchange.findfolders(wellknownfoldername.publicfoldersroot, filter, fview); if (fldrs != null) return fldrs.firstordefault(); }
that return folder in root of public folder tree name. if want go deeper can walk tree using method:
public folder getfolder(folder src, string foldername) { folderview fview = new folderview(100); fview.propertyset = new propertyset(basepropertyset.idonly); fview.propertyset.add(folderschema.displayname); fview.traversal = foldertraversal.shallow; searchfilter filter = new searchfilter.containssubstring(folderschema.displayname, foldername); var fldrs = src.findfolders(filter, fview); if (fldrs == null) return null; return fldrs.firstordefault(); }
you can monkey traversal
option , searchfilter
exchange webservices of work you. public folders stored on server in country (not choice) faster way. ymmv.
for of above you'll need include following:
using system.net; using microsoft.exchange.webservices.data;
Comments
Post a Comment