Share via

Site usage in Sharepoint

Anonymous
2023-05-15T07:50:42+00:00

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?

Microsoft 365 and Office | SharePoint | For business | Windows

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.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2023-05-15T10:39:25+00:00

    Thank you

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2023-05-15T10:27:16+00:00

    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

    Was this answer helpful?

    0 comments No comments