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 = “
$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 ::..