2017-11-03 8 views
0

C#CSOMコードを使用してSharepoint List Viewを作成しています。 ViewCreationInformationを使用してビューを作成しています。私はそれのためのクエリを書く際に問題に直面している。Camlクエリーがビュー作成共有ポイントで機能しない

この作品執筆:

  ViewCollection viewColl = list.Views; 
      string[] viewFields = {"Id", "Action", "Created", "Created By"}; 
      ViewCreationInformation creationInfo = new ViewCreationInformation(); 
      creationInfo.Title = "FromCode"; 
      creationInfo.ViewFields = viewFields; 
      creationInfo.Query = @"<Where><Neq><FieldRef Name=""ConfidentialDocument""/><Value Type=""Choice"">No</Value></Neq></Where><GroupBy><FieldRef Name=""TemplateName"" /><FieldRef Name=""Title"" /></GroupBy><OrderBy><FieldRef Name=""Created"" Ascending=""True"" /></OrderBy>"; 
      creationInfo.ViewTypeKind = ViewType.Html; 
      creationInfo.RowLimit = 30; 
      creationInfo.Paged = true; 
      creationInfo.SetAsDefaultView = true; 
      viewColl.Add(creationInfo); 

をしかし、私はこれにクエリ変更する場合:

  creationInfo.Query = @"<Where><Neq><FieldRef Name=""ConfidentialDocument""/><Value Type=""Choice"">No</Value></Neq></Where><GroupBy Collapse=""TRUE"" GroupLimit=""30""><FieldRef Name=""TemplateName"" /><FieldRef Name=""Title"" /></GroupBy><OrderBy><FieldRef Name=""Created"" Ascending=""True"" /></OrderBy>"; 

を次にビューにエラーが表示されます。 TypeError: Unable to get property 'substring' of undefined or null reference

あなたがリンクをチェックすることができますかここにエラーがあります: TypeError:未定義またはnull参照のプロパティ 'substring'を取得できません

TypeError: Unable to get property 'substring' of undefined or null referenceTypeError: Unable to get property '_events' of undefined or null reference 

誰もがこれについて考えていますか?私は多くの場所を検索しました。どこでも同じようなコードが見つかりました。私はなぜこのコードが動作していないのかわかりません。

+0

私はMicrosoft.SharePoint.dllにアクセスできないと言わなければなりません。 Microsoft.Sharepoint.client.dllを使用しています(すべてのクライアントDLLが正確です)。 – Griph

答えて

0

[OK]問題はGroupLimit = "" 30 ""でした。 GroupLimitを使用しないクエリは完全に正常に動作します。

 creationInfo.Query = @"<Where><Neq><FieldRef Name=""ConfidentialDocument""/><Value Type=""Choice"">No</Value></Neq></Where><GroupBy Collapse=""TRUE""><FieldRef Name=""TemplateName"" /><FieldRef Name=""Title"" /></GroupBy><OrderBy><FieldRef Name=""Created"" Ascending=""True"" /></OrderBy>"; 
関連する問題