2014-09-29 47 views
0

我試圖通過Dynamics CRM 2013插件對Sharepoint 2013進行身份驗證,所有這些都在單個Office 365環境中進行。 我最終試圖將電子郵件附件從Dynamics CRM複製到Sharepoint(發佈電子郵件附件創建異步)。 到目前爲止,這段旅程充滿了障礙。Office 365:在Dynamics CRM插件和Sharepoint之間進行身份驗證

  • 我已經去AppRegNew.aspx得到一個客戶端ID和祕密。
  • 我已經建立了一個web請求,並將信息發佈到 mycompanyname.sharepoint.com/_layouts/15/OAuthAuthorize.aspx但收到403 Forbidden錯誤。
  • 因爲我無法將Sharepoint.Client.dll部署到Dynamics CRM Online中無法使用CSOM
  • 我不知道是什麼在請求PARAMATERS範圍應該是

這裏是從我至今代碼摘錄:

string clientId = "myclientid"; 
string clientSecret = "asecretstring"; 

this.request = string.Format("grant_type=client_credentials&client_id={0}&client_secret={1}&scope=list.read", Uri.EscapeDataString(clientId), Uri.EscapeDataString(clientSecret)); 

WebRequest webRequest = WebRequest.Create(OAuthUri); 
webRequest.ContentType = "application/x-www-form-urlencoded"; 
webRequest.Method = "POST"; 
byte[] bytes = Encoding.ASCII.GetBytes(this.request); 
webRequest.ContentLength = bytes.Length; 
using (Stream outputStream = webRequest.GetRequestStream()) 
{ 
    outputStream.Write(bytes, 0, bytes.Length); 
} 
using (WebResponse webResponse = webRequest.GetResponse()) 
{ 
    // get token from the response 
} 

我真的很感激,在兩個Office 365的系統之間進行認證 一些方向。

回答

0

您還需要將請求

上的UserAgent字符串設置爲「--Mozilla/5.0(compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)」
相關問題