开发者

SharePoint CAML Query Maximum Size

开发者 https://www.devze.com 2023-02-14 23:41 出处:网络
I am running a sharepoint caml query where I want to check that a field on an item is equal to one of many values. I do this dynamically and may wish to check against many hundreds of values.

I am running a sharepoint caml query where I want to check that a field on an item is equal to one of many values. I do this dynamically and may wish to check against many hundreds of values.

I found that when performing a query with 780 OR element开发者_运维问答s I got an error related to server memory. Obviously this is variable across environments, but I am looking for some guidelines suggesting a maximum query length to which I should cap.

Thanks!


How about using ContentIterator? http://community.zevenseas.com/Blogs/Robin/Lists/Posts/Post.aspx?ID=122

It supports recursion for walking a tree of items and acting on them in some way. This code does a "publish all" on the style library files whose "FeatureId" properties match a particular value:

SPList styleLibrary = rootWeb.Lists.TryGetList("Style Library");
SPFolder folder = styleLibrary.RootFolder;
ContentIterator ci = new ContentIterator();
ci.ProcessFilesInFolder(
    styleLibrary,
    folder,
    true,
    new ContentIterator.FileProcessor((SPFile f) =>
    {
        // Check the FeatureId property the file's been "stamped" with
        if (f.Properties.ContainsKey("FeatureId"))
        {
            if (String.Equals(f.Properties["FeatureId"] as string, featureId, StringComparison.InvariantCultureIgnoreCase))
            {
                if (f.Level == SPFileLevel.Checkout)
                    f.CheckIn(String.Empty, SPCheckinType.MajorCheckIn);
                if (f.Level == SPFileLevel.Draft)
                    f.Publish("");
            }
        }
    }),
    new ContentIterator.FileProcessorErrorCallout((SPFile f, Exception Ex) =>
    {
        //Define the action I need to do if an error occur
        return false;
    }));


You could get all folders by SPList.Folders, iterate over the folders and filter it by whatever...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号