2017-09-28 11 views
0

最近、プロバイダをホストしてオンラインでポイントを共有するアプリケーションを作成しようとしていました。 私はAzureのWebアプリケーションを設定し、そのアプリケーションを作成してオンラインで共有ポイントに公開しました。私は今、SharePointオンラインアプリカタログでアプリを見ることができます。アプリケーションを実行しようとすると、以下のエラーがスローされます。プロバイダのホストされたアプリケーションをSharePointオンラインで実行しようとしたときにエラーが発生しました

System.IO.FileNotFoundException: msoidcliL.dll at Microsoft.SharePoint.Client.Idcrl.IdcrlNativeMethodsSelector..ctor(String dllPath) at Microsoft.SharePoint.Client.Idcrl.ManagedIdcrl.get_IdcrlNativeMethods() at Microsoft.SharePoint.Client.Idcrl.ManagedIdcrl.EnsureInited() at Microsoft.SharePoint.Client.Idcrl.ManagedIdcrl.LogonIdentity(String username, SecureString password) at Microsoft.SharePoint.Client.Idcrl.SharePointOnlineAuthenticationProvider.Logon(String username, SecureString password) at Microsoft.SharePoint.Client.SharePointOnlineCredentials..ctor(String username, SecureString password) at SharePointApp5Web.Default.Page_Load(Object sender, EventArgs e) 

コード

var spContext = SharePointContextProvider.Current.GetSharePointContext(Context); 

     try 
     { 
      string str; 
      using (ClientContext ctx = new ClientContext("https://mydomain.sharepoint.com/sites/General/Community%20Portal/HR/Acknowledgements")) 
      { 
       ctx.Credentials = new Microsoft.SharePoint.Client.SharePointOnlineCredentials("[email protected]", ConvertToSecureString("password")); 

       Web myweb = ctx.Web; 
       List myList = myweb.Lists.GetByTitle("Timesheet Administration Policy"); 
       ListItemCreationInformation ItemCreationInfo = new ListItemCreationInformation(); 

       CamlQuery camlQuery = new CamlQuery(); 
       camlQuery.ViewXml = 
        @"<Query> 
        <Where> 
         <Neq> 
         <FieldRef Name='ID' /> 
         <Value Type='Counter'>946</Value> 
         </Neq> 
        </Where> 
       </Query>"; 


       Microsoft.SharePoint.Client.ListItemCollection listItems = myList.GetItems(camlQuery); 
       ctx.Load(listItems); 
       ctx.ExecuteQuery(); 


        foreach (Microsoft.SharePoint.Client.ListItem listItem in listItems.ToList()) 
        { 

         try 
         { 
          Response.Write(listItem["Email_x0020_Address"].ToString().Trim()); 

         } 
         catch (Exception ex) 
         { 
          Response.Write(ex.ToString()); 
         } 
        } 
       } 
     } 
     catch (Exception ex) 
     { 
      Response.Write(ex.ToString()); 
     } 

答えて

1

はCSOMのDLLの問題のように見えます。最新のCSOMオンライン版をインストールし、コードを展開/公開してください。 Visual Studioでプロジェクトの参照に

ゴー、以下のようにManage Nuget packagesを開くために、右:CSOMため

enter image description here

検索をしてMicrosoft.SharePointOnline.CSOM

enter image description here

または、交互をインストールするには、下記のMicrosoftのダウンロードリンクからダウンロードし、参照を手動で追加することができます。

SharePoint Online Client Components SDK

また、.NET Frameworkがv4.5に標的化されると、プラットフォームのターゲットがAny CPUに設定されていることを確認してください。また、v16アセンブリが参照されていることを確認します。また

ctx.Credentials行の下に次のコードを追加します。

ctx.AuthenticationMode = ClientAuthenticationMode.Default; 
+0

あなたもこのライン 'ctx.AuthenticationMode = ClientAuthenticationMode.Defaultを追加できるように行われますが – Rinu

+1

上記と同じエラーを得た;' '下回りますctx.Credentials'行とチェック?また、プロジェクトが.Netフレームワーク4.5にターゲット設定され、プラットフォームターゲットが '' Any CPU'に設定されていることを確認してください。そのv16アセンブリを確認してください –

+0

チャームのように働いた! :)。あなたは答えを更新できますか?私はそれを答えとしてマークすることができます。 – Rinu

関連する問題