2016-04-21 113 views
1

我想在C#中爲sharepoint編寫一個mailsender,但每次啓動它時,都會收到此錯誤消息,告訴我它沒有權限。Sharepoint csom mailsender權限

我試過在AppManifest.xml上給它權限,但我不知道哪個......我嘗試了所有,但沒有任何接縫可以幫助。

我的代碼:

private void SendEmail(ClientContext clientContext) 
{ 
    User sendToUser = clientContext.Web.EnsureUser("[email protected]"); 
    clientContext.Load(sendToUser); 
    clientContext.ExecuteQuery(); 

    string email = Microsoft.SharePoint.Client.Utilities.Utility.GetCurrentUserEmailAddresses(clientContext).Value; 

    Microsoft.SharePoint.Client.Utilities.EmailProperties properties = new Microsoft.SharePoint.Client.Utilities.EmailProperties(); 
    properties.To = new string[] { sendToUser.Email }; 
    properties.Subject = "subject"; 
    properties.Body = "body"; 

    Microsoft.SharePoint.Client.Utilities.Utility.SendEmail(clientContext, properties); 

    clientContext.ExecuteQuery(); 
} 

該做什麼有人有我一個提示,這可能是錯誤的。

回答

0

給發送者(CurrentUser)的 「管理警報」

許可