Project Online - How to filter projects in powershell?

%3CLINGO-SUB%20id%3D%22lingo-sub-2106196%22%20slang%3D%22en-US%22%3EProject%20Online%20-%20How%20to%20filter%20projects%20in%20powershell%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2106196%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20Everyone%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20want%20to%20filter%20projects%20on%20LastPublishedDate%20in%20power%20shell.%20How%20to%20include%20%24filter%20query%20string%20in%20the%20endpoint.%3C%2FP%3E%3CP%3EFor%20example%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fexample.sharepoint.com%2Fsites%2Fpwa%2F_api%2FProjectServer%2FProjects%3F%24filter%3DLastPublishedDate%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fexample.sharepoint.com%2Fsites%2Fpwa%2F_api%2FProjectServer%2FProjects%3F%24filter%3DLastPublishedDate%3C%2FA%3E%20-ge%20datetime'28-01-2021'%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20I%20open%20my%20URL%20with%20same%20format%20in%20browser%20it%20works%20fine.%20But%20when%20I%20include%20it%20in%20the%20power%20shell%2C%20all%20projects%20are%20returned.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20using%20these%20samples%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FOfficeDev%2FProject-Samples%2Ftree%2Fmaster%2FO365-Project-Online-REST-Samples%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FOfficeDev%2FProject-Samples%2Ftree%2Fmaster%2FO365-Project-Online-REST-Samples%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoes%20anyone%20knows%20the%20correct%20way%20to%20include%20%24filter%20query%20string%20in%20power%20shell%20script%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20%26amp%3B%20Regards%2C%3C%2FP%3E%3CP%3ERohan%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2106196%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAPI%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOnline%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPower%20shell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EProject%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EProject%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Contributor

Hello Everyone,

 

I want to filter projects on LastPublishedDate in power shell. How to include $filter query string in the endpoint.

For example,

 

https://example.sharepoint.com/sites/pwa/_api/ProjectServer/Projects?$filter=LastPublishedDate -ge datetime'28-01-2021'

 

When I open my URL with same format in browser it works fine. But when I include it in the power shell, all projects are returned.

 

I'm using these samples:

 

https://github.com/OfficeDev/Project-Samples/tree/master/O365-Project-Online-REST-Samples

 

Does anyone knows the correct way to include $filter query string in power shell script?

 

Thanks & Regards,

Rohan

 

1 Reply
Issue has been resolved. Escaped $filter with back-tick `$filter.