Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Need more documentation for Add-SPOView #55

Closed
hanielc opened this issue Sep 8, 2015 · 4 comments
Closed

Need more documentation for Add-SPOView #55

hanielc opened this issue Sep 8, 2015 · 4 comments

Comments

@hanielc
Copy link

hanielc commented Sep 8, 2015

Hi,

Could you provide some more details on the Add-SPOView cmdlet, particularly around the Query string? Can it be used to define groups and filters?

@erwinvanhunen
Copy link
Member

Hi,

Yes you can. The Query string is a normal CAML query. The MSDN page about the property is pretty limited unfortunately, https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.viewcreationinformation.query.aspx

You can however find a view in your site that uses a query that is pretty similar to the one you want to build, and then retrieve the query with:

$view = Get-SPOView -List <listname> -Identity <viewname>
$view.ViewQuery

I will update the description of the parameter to state that it is a CAML query.

@erwinvanhunen
Copy link
Member

I added the additional text in PR #56 . Thanks for bringing this to my attention!

Closing the issue.

@hanielc
Copy link
Author

hanielc commented Sep 8, 2015

Thanks for your prompt reply, Erwin. I tried your recommendation and got:

<Where><Eq><FieldRef Name="ContentType" /><Value Type="Computed">News</Value></Eq></Where>

However, it doesn't actually create the filter. Wrapping it in <Query>...</Query> didn't work either.

Any other suggestions?

@kilasuit
Copy link
Contributor

@hanielc enclose the query in apostrophe's like the below

 '<Where><Eq><FieldRef Name="ContentType" /><Value Type="Computed">News</Value></Eq></Where>'

else powershell will look to the space in between FieldRef Name as the end of the parameter's value

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants