1

I tried to write a little application to get some kinds of extended Analytics.

I could get some very interesting numbers about Usage, Search terms, Used Memory etc. But while trying to access all Threads in the Newsfeed of a Teamsite I found a little barrier. When you try to find out how many posts do exist in one SiteCollection you can do that via:

var feedOption = new SPSocialFeedOptions
                        {
                            SortOrder = SPSocialFeedSortOrder.ByCreatedTime,
                            MaxThreadCount = 2000
                        };
var feeds = feedManager.GetFeedFor($"{mySite.Url}/newsfeed.aspx", feedOption);

But when you count the number of Threads in the feed:

feeds.Threads.Length

You will get a maximum of 100 Threads. It seems to be irrelevant what value you set for "MaxThreadCount", you only get Thread 0-99 (also tried using int.MaxValue).

Even if the MicroFeed list in that SiteCollection has 300 Posts, I can`t get the correct number of posts with the feedManager.

I couldn`t find any hint about this limitation in the MSDN description of the SPSocialFeed class or the Threads.

Is there another way to get the number of all existing Threads in a site newsfeed?

  • And as mentioned in my Answer below, there is no limit in the description of SPSocialFeedOptions.MaxThreadCount in the german version. Only in the US Version of this article you can find the text mentioned by M.Qassas. – Leviani Nov 27 '17 at 8:17
2

It's normal behavior, 2000 is invalid value for The SPSocialFeedOptions.MaxThreadCount

  • The Valid values are between zero and 100.
  • The default number of threads returned is 20.
  • Setting the value to zero will set the MaxThreadCount property to the default value of 20.

The SPSocialFeedOptions.MaxThreadCount limitations is mentioned at this MSDN documntation SPSocialFeedOptions.MaxThreadCount

  • Thank you for that Information. Any Idea how I could achieve my requirement of getting the actual number of posts in a newsfeed ? – Leviani Oct 27 '17 at 6:55
  • @Leviani You are welcome, unfortunately, no it's a property limitation as mentioned in MSDN. – Mohamed El-Qassas MVP Oct 27 '17 at 6:57
0

Wow. I found the reason for my problems. As M.Qassas wrote, there IS a limit to the int value of the property MaxThreadCount.

I couldn`t find it in the article https://msdn.microsoft.com/de-de/library/microsoft.office.server.social.spsocialfeedoptions.maxthreadcount.aspx , even if I set the page language to English.

But if you open the same article with the link from Qassas https://msdn.microsoft.com/en-us/library/microsoft.office.server.social.spsocialfeedoptions.maxthreadcount.aspx

You can clearly see another portion of text, telling me "Gets or sets the maximum number of threads to retrieve. Valid values are between zero and 100"

Really ?

  • Great! This is what I have mentioned in my answer since two weeks :) So I am wondering Why my answer is not marked as accepted? :( – Mohamed El-Qassas MVP Nov 7 '17 at 13:28
  • Sorry, my mistake and corrected :) – Leviani Nov 7 '17 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.