2013-04-22 88 views
3

我們的Exchange管理員(Exchange 2010 SP1)已經設置了共享資源日曆。 沒有郵箱分配給此資源日曆。我希望能夠使用EWS和C#閱讀會議。通過EWS和C訪問沒有郵箱的資源日曆#

段:

 ExchangeService esvc = new ExchangeService(ExchangeVersion.Exchange2010); 
     esvc.Credentials = new WebCredentials(username, password, "ourplace.org"); 
     esvc.Url = new Uri("https://OWA.OURPLACE.ORG/EWS/Exchange.asmx"); 

     FolderId shareFolderId = new FolderId(WellKnownFolderName.Calendar, "Shared Calendar Name"); 
     CalendarFolder.Bind(esvc, shareFolderId); 

綁定語句拋出的錯誤:「SMTP地址沒有與之關聯的郵箱。」

如何閱讀共享資源日曆上沒有關聯郵箱的項目......或者甚至有可能嗎?

謝謝!

+0

嗨@ user2308563,你找到答案?試過下面的答案成功。
當右鍵單擊我的日曆> [email protected]>屬性
下的地方有這麼一句話:\\ [email protected]
另外一個它讀取\\ Jhon_Doe – jpfreire 2017-06-13 14:10:25

回答

0

如果日曆實際上不在任何特定郵箱中,那麼它應該在公用文件夾中,並且您應該查看子文件夾WellKnownFolderName.PublicFoldersRoot

否則,請告知它在Outlook文件夾層次結構中的確切位置。

2

綁定到與該日曆郵件ADRESS

建立首先是一個FolderId的:

FolderId parkplatzCalendarId = new FolderId(WellKnownFolderName.Calendar,"[email protected]"); 

然後綁定到這一個:

CalendarFolder calendar = CalendarFolder.Bind(_service, parkplatzCalendarId); 

現在你可以使用這個日曆!

CalendarView cView = new CalendarView(start, end, int.MaxValue); 

cView.PropertySet = new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End, AppointmentSchema.Duration, AppointmentSchema.LastModifiedName, AppointmentSchema.Organizer, AppointmentSchema.Categories); 

FindItemsResults<Appointment> appointments = calendar.FindAppointments(cView); 

有了類似的東西; d

+1

同樣重要的是要注意,你的用戶'根據需要委派對資源日曆的訪問權限登錄。我剛剛有兩個小時的權限問題。 – BCza 2014-07-16 16:50:07

+0

如上所述,與具有委派訪問權的用戶相關聯,然後使用日曆的電子郵件格式創建folderId對象:[email protected] – jpfreire 2017-06-13 15:20:14