SPFX @pnp/graph

%3CLINGO-SUB%20id%3D%22lingo-sub-1312169%22%20slang%3D%22en-US%22%3ESPFX%20%40pnp%2Fgraph%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1312169%22%20slang%3D%22en-US%22%3E%3CP%3EAm%20trying%20to%20use%20beta%20endpoint%20for%20my%20graph%20API%20request.%26nbsp%3B%20I%20tried%20setEndpoint%2C%20but%20it%20run%20out%20of%20error.%20Could%20not%20find%20the%20correct%20way%20to%20point%20to%20beta%20instead%20of%20v1.0.%20Am%20trying%20to%20filter%20teams%20from%20the%20groups%2C%20but%20the%20filter%20is%20not%20working%20v1.0%20endpoint.%20Please%20suggest%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Egraph%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3Egroups%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3Efilter%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3E%60resourceProvisioningOptions%2FAny(x%3Ax%26nbsp%3Beq%26nbsp%3B'Team')%60%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3Eget%3C%2FSPAN%3E%3CSPAN%3E%26lt%3B%3C%2FSPAN%3E%3CSPAN%3EGroup%3C%2FSPAN%3E%3CSPAN%3E%5B%5D%26gt%3B()%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%26nbsp%3B%26nbs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sp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1312169%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESPFx%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1313216%22%20slang%3D%22en-US%22%3ERe%3A%20SPFX%20%40pnp%2Fgraph%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1313216%22%20slang%3D%22en-US%22%3E%3CP%3EHey%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F188457%22%20target%3D%22_blank%22%3E%40Shibu%20Mathew%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYeah%2C%20I%20wan't%20able%20to%20use%20the%20filter%20in%20graph%20queries%20either.%20I%20haven't%20used%20PnPJS%20for%20graph%20requests%20so%20I'm%20not%20sure%20what%20the%20problem%20is.%20Anyway%2C%20I%20think%20you%20can%20use%20the%20concat%20function%20to%20add%20your%20filter%20manually%2C%20like%20.concat(%3CSPAN%3E%60%3F%24filter%3DresourceProvisioningOptions%2FAny(x%3Ax%26nbsp%3Beq%26nbsp%3B'Team')%60).%20Let%20me%20know%20if%20it%20doesn't%20work%20for%20you.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Am trying to use beta endpoint for my graph API request.  I tried setEndpoint, but it run out of error. Could not find the correct way to point to beta instead of v1.0. Am trying to filter teams from the groups, but the filter is not working v1.0 endpoint. Please suggest

 

 graph.groups
      .filter(`resourceProvisioningOptions/Any(x:x eq 'Team')`)
      .get<Group[]>()
      .then((groups=> {
        console.log("groups....."groups);
        this.setState({
          groups,
        });
      });
1 Reply
Highlighted

Hey @Shibu Mathew ,

 

Yeah, I wan't able to use the filter in graph queries either. I haven't used PnPJS for graph requests so I'm not sure what the problem is. Anyway, I think you can use the concat function to add your filter manually, like .concat(`?$filter=resourceProvisioningOptions/Any(x:x eq 'Team')`). Let me know if it doesn't work for you.