Web パーツで SharePoint クライアント オブジェクト モデルを使用できますか?
このコードは私のコンソール アプリケーションでは機能しますが、Web パーツでは「リモート サーバーがエラーを返しました: (401) Unauthorized」を返します。
コードは次のとおりです。
var siteUrl = "http://www.server.com/";
var clientContext = new ClientContext(siteUrl);
var root = clientContext.Site.RootWeb;
WebCollection collWeb = root.GetSubwebsForCurrentUser(null);
clientContext.Load(root);
clientContext.Load(collWeb);
clientContext.ExecuteQuery();
問題は、クライアント コンテキストが現在のユーザー資格情報を使用していないことにある可能性があります。私は何をすべきか?