A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
Thank you
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I can't get the query statistics with the method I used to use
and unfortunately I can't find a new way to do it programmatically
At the moment, the only way is to use the new graphical interface:
/sites/applications/XXX/corporate/_layouts/15/siteanalytics.aspx?view=19
I still have to change the URL on each site and it only shows the most popular documents from the last 7 days
I used to use the search service to get the properties:
ViewsLifeTime
ViewsLifeTimeUniqueUsers
ViewsRecent
ViewsRecentUniqueUsers
I used a powershell like:
$keywordQuery = New-Object Microsoft.SharePoint.Client.Search.Query.KeywordQuery($context)
$keywordQuery.QueryText = "path: "+$urlFile
$keywordQuery.RowLimit=10
$keywordQuery.TrimDuplicates=$false
$keywordQuery.StartRow=0
$keywordQuery.SelectProperties.Add("ViewsLifeTime")
$keywordQuery.SelectProperties.Add("ViewsLifeTimeUniqueUsers")
$keywordQuery.SelectProperties.Add("ViewsRecent")
$keywordQuery.SelectProperties.Add("ViewsRecentUniqueUsers")
Now it always returns 0
I was wondering if there was a way to overcome this obstacle?
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Thank you
Dear COSTA Bruno - External,
Greetings! Thank you for posting in Microsoft Community.
Per your description, it seems that you cannot get the query statistics of SharePoint site usage with programmatical method, you used a powershell method.
May I know if my understanding of the scenario is right?
If yes, considering that we mainly focus on general and built-in features in SharePoint Online, your question involves powershell and you want a new way to do it programmatically. Since we have a dedicated channel Microsoft Q&A Community, for you to be assisted properly, we sincerely recommend you go to that community and post a new thread, you may use SharePoint tag or SharePoint Development tag when asking question. Members and engineers over there are proficient in the knowledge of PowerShell scripts and SharePoint customization, development queries. We are sure that our experts from that team can address your query effectively and accurately.
If my understanding of the scenario is not consistent with yours, feel free to point it out.
Thanks for your understanding and cooperation! Hope you keep safe and healthy always.
Sincerely,
Tina | Microsoft Community Moderator