0

我有要求獲取共享點文件的文件流,爲我有共享點文件的URL。如何從動態crm插件中的sharepoint文件url獲取文件流?

https://mysite.sharepoint.com/sites/documents/contact/test/Beat01_07262017.pdf

我試圖從CRM Online中的插件內連接到SharePoint Online中(使用CSOM)。爲此,我將SharePoint Client和Client.Runtime DLL與ilmerge.exe合併到我的插件DLL中。但是,只要下面的代碼:

ClientContext clientContext = new ClientContext(server); 
clientContext.Credentials = new SharePointOnlineCredentials(UserId, Password); // This line throws an below exception: 

請求類型的許可 「System.Security.Permissions.RegistryPermission,mscorlib程序, 版本= 4.0.0.0,文化=中性公鑰= b77a5c561934e089' 失敗。

有什麼辦法可以讓它工作嗎?

我與SharePoint Integration from CRM Online Workflow/Plugin檢查,但沒有能夠得到它的工作 並得到如下錯誤

例外:異常已通過調用的目標引發異常。

堆棧跟蹤在System.RuntimeMethodHandle.InvokeMethod(對象目標,對象[] 參數,簽名Sig,布爾構造函數) 在System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(對象OBJ, 對象[]參數,對象[]參數) 在System.Delegate.DynamicInvokeImpl(對象[]參數) 在Microsoft.Xrm.Sdk.Linq.QueryProvider.DynamicInvoke(委託項目, 對象[]參數) 在Microsoft.Xrm。 Sdk.Linq.QueryProvider.TranslateExpressionToConditionValue(Expression EXP,ParameterExpression []參數) 在Microsoft.Xrm.Sdk.Linq.QueryProvider.TranslateWhereCondition(BinaryExpression 是,FilterExpressionWrapper parentFilter,Func鍵2用getFilter,Func鍵2 getLinkLookup,布爾否定) 在Microsoft.Xrm.Sdk .Linq.QueryProvider.TranslateWhere(字符串 參數名稱,BinaryExpression是,FilterExpressionWrapper parentFilter,Func鍵2用getFilter,列表1個linkLookups,布爾 否定) 在Microsoft.Xrm.Sdk.Linq.QueryProvider.TranslateWhereBoolean(字符串 參數名稱,表達exp,FilterExpressionWrapper parentFilter, Func 2 getFilter,List 1 linkLookup S,BinaryExpression父,布爾 否定) 在Microsoft.Xrm.Sdk.Linq.QueryProvider.TranslateWhere(QueryExpression QE,字符串參數名稱,表達式exp,列表1個linkLookups) 在Microsoft.Xrm.Sdk.Linq.QueryProvider 。GetQueryExpression(表達式 表達,布爾& throwIfSequenceIsEmpty,布爾& throwIfSequenceNotSingle,投影&投影, NavigationSource &源,列表1個& linkLookups) 在Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute [TElement](表達式 表達) 在Microsoft.Xrm.Sdk.Linq.QueryProvider.System.Linq.IQueryProvider.Execute [TResult](式 表達) 在System.Linq.Queryable.FirstOrDefault [TSource](1個IQueryable的源 ) 在CRMPluginProject1._365Immo.Laurus.SharePoint.DocumentLocationHelper.GetDocumentLocationPath(SharePointDocumentLocation parentLocation) 在CRMPluginProject1._365Immo.Laurus.SharePoint.DocumentLocationHelper.CreateDocumentLocation(實體 網站,絃樂documentLibraryName,的EntityReference regardingRecord) 在CRMPluginProject1._365Immo .Laurus.Plugins.GetSharePointFile.Execute(IServiceProvider的 的ServiceProvider)

內部異常: 的需求未能由於創作的過程中捕捉的代碼訪問安全性信息,匿名運行 動態方法。爲了使此操作成功,請確保 需求在創建方法時成功。 有關更多 的信息,請參閱http://go.microsoft.com/fwlink/?LinkId=288746

堆棧跟蹤:在lambda_method(關閉)

回答

1

SharePoint客戶端庫顯然需要訪問Windows註冊表。這在沙盒CRM插件中是不允許的。

在沙盒插件中,只允許使用http或https協議訪問Web上的資源。 (IP地址也是不允許的。)

+0

我有要求從共享點訪問文件。我怎麼能實現它?對於從CRM上傳文件到Sharepoint,我使用了第三方插件,它返回文件的URL。如「https://mysite.sharepoint.com/sites/documents/contact/test/Beat01_07262017.pdf」 –

相關問題