2017-09-11 72 views
0

這是我的代碼編輯GAL編輯全局地址列表的Office 365時,收到錯誤如何使用C#

消息=您沒有足夠的權限在此對象上執行此操作 。來源= Microsoft Outlook。

無法通過outlook API進行編輯管理員用戶?

Outlook.Application oApp = new Outlook.Application(); 

Outlook.AddressEntry dlEntry = oApp.GetNamespace("MAPI").AddressLists["Global Address List"].AddressEntries["Global Employees"]; 
Outlook.AddressEntries members = dlEntry.Members; 


foreach (Outlook.AddressEntry member in members) 
{ 
    MessageBox.Show(member.Name + ":" + member.Address + ":" + member.GetExchangeUser().JobTitle); 
    member.Name = member.Name + " Edited"; 
    member.GetExchangeUser().JobTitle = member.GetExchangeUser().JobTitle + " Edited";; 
    member.Update(); 
} 

回答

0

GAL(全局地址列表)是從Active Directory元素生成的。因此,您需要編輯unterlaying活動目錄,而不是直接編輯GAL。對於Exchange Online(部分來自Office 365),它是Azure Active Directory的下層。

如果您使用DirSync/Azure AD Connect,則還可以更新您的駐地Active Directory環境中的內容,以便它與Azure Active Directory同步。

+0

好的。你能否給我任何編輯office365活動目錄的示例代碼?我不明白爲什麼這些是Outlook.Application API中的update()和create()方法 – shizil