2

クライアント オブジェクト モデルを使用して、sharepoint 2010 サイトからリモートでデータにアクセスしようとしています。いくつかの制限により、ユーザー ログインに基づいて適切な対象者をフィルター処理できません (CAML クエリに関して助けていただければ、それも問題ありません:: 取得方法がわかりません)。 CAML/クライアント オブジェクト モデルを使用する現在のユーザー オーディエンス名とすべてのオーディエンス (このコードはモバイル サイトにあり、私のコードに示すように共有ポイント サイトを呼び出します)。この次のコードは正常に機能しますが、Web パーツからコンテンツを取得できません。誰かがこれに関して助けてくれますか。

    using (ClientContext ctx = new ClientContext("https://mysite.com/Pages/Default.aspx"))
      {
                 ctx.ExecutingWebRequest += new EventHandler<WebRequestEventArgs>   (clientContext_ExecutingWebRequest);    

                 File home=ctx.Web.GetFileByServerRelativeUrl("/Student/Pages/default.aspx");                      
             //get the web part manager
                     Microsoft.SharePoint.Client.WebParts.LimitedWebPartManager wpm = home.GetLimitedWebPartManager(Microsoft.SharePoint.Client.WebParts.PersonalizationScope.Shared);

                IEnumerable<Microsoft.SharePoint.Client.WebParts.WebPartDefinition> wpds = null;
             //create the LINQ query to get the web parts from
             //the web part definition collection
                wpds = ctx.LoadQuery(wpm.WebParts.Include(wp => wp.Id,wp => wp.WebPart)); 
             //load the list of web parts
                ctx.ExecuteQuery();
             //enumerate the results
                foreach (Microsoft.SharePoint.Client.WebParts.WebPartDefinition wpd in wpds)
                {
                   string title=  wpd.WebPart.Title;
                   Microsoft.SharePoint.Client.WebParts.WebPart wpart = wpd.WebPart;     

                  ????? How to render and receive the data (looking for the same data When you browse the site with the browser)      
                }

              Code continues...
4

1 に答える 1

0

私もこの問題に苦労しています。これはクライアント オブジェクト モデルでは不可能のようです。実はBuild Conference 2012でSharePointのスタッフに聞いてみたことがあります。

しかし、SharePoint Designer を使用すると、必要な WebPart をダウンロードすることが実際に可能です。Fiddler は、どのサービスがビットを提供するかを追跡するのに便利な場合があります。

こちらの SharePoint StackExchangeの投稿をご覧ください。

残念ながら、投稿はそれを解決する具体的な方法を提供しません。

幸運を願っています!

于 2013-02-08T11:12:08.470 に答える