SP2010 Query Agenda items from Meeting Workspace does not return values

Powershell Script

I think that might be interesting. If you query a list – it doesn’t matter what kind of list – it returns the desired values… normally… BUT there is one exception. If you use the template Meeting Workspace in SharePoint with multiple dates and you would like to get all agenda items for the next meeting after the upcoming, your script won’t return any values. It doesn’t matter if you are using

  • the query in Nintex Workflow
  • c#
  • powershell

The reason for this is simple but not nice. The meeting workspace uses an instance id for each meeting. As default it returns the current meeting items or the items from upcoming event. For quering the next meeting after the upcoming you should make sure to set the instance id right. I added as example my script:

[sourcecode language=”csharp”]

$MeetingWorkspaceUrl = “http://server/sites/sitecollection/MeetingWorkspaceUrl/default.aspx?InstanceID=2”
$CurrentInstancID = $MeetingWorkspaceUrl.Split(“=”)[1]

$web = Get-SPWeb $MeetingWorkspaceUrl.Substring(0,$MeetingWorkspaceUrl.lastIndexOf(“/”))
$List = $web.Lists[“Agenda”]
$ListItem = $List.Items | ? {$_[“Instance ID”] -eq $CurrentInstancID }

$spQuery = New-Object Microsoft.SharePoint.SPQuery
$spQuery.MeetingInstanceId = $CurrentInstancID
$spQuery.Query = “Test

$ListItems = $List.GetItems($spQuery)
foreach ($Item in $ListItems)
{
$Item[“Title”] = “Test2”
$Item.Update()
}

[/sourcecode]

The line 9 is the important one. By default it is set to -3 which means that it only queries the upcoming event. But i want to query the next event, so i set it to my own instance id which is “2”. In the query you can now select all items which has “Text” in Title field or which has a special ItemId.

Hope this helps you.

..:: I LIKE SHAREPOINT ::..

The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.

About Karsten Schneider 312 Articles
Consultant for Microsoft 365 Applications with a strong focus in Teams, SharePoint Online, OneDrive for Business as well as PowerPlatform with PowerApps, Flow and PowerBI. I provide Workshops for Governance & Security in Office 365 and Development of Solutions in the area of Collaboration and Teamwork based on Microsoft 365 and Azure Cloud Solutions. In his free time he tries to collect tipps and worthy experience in this blog.