Can a variable be coded in CAML powershell for Sharepoint online?

%3CLINGO-SUB%20id%3D%22lingo-sub-186016%22%20slang%3D%22en-US%22%3ECan%20a%20variable%20be%20coded%20in%20CAML%20powershell%20for%20Sharepoint%20online%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-186016%22%20slang%3D%22en-US%22%3E%3CP%3E%24Items%20%3D%20Get-PNPListItem%20-List%20'ListBB'%20-Query%20%3CVIEW%3E%3CQUERY%3E%3CWHERE%3E%3CEQ%3E%3CFIELDREF%20name%3D%22'fueltype'%2F%22%3E%3CVALUE%20type%3D%22'Text'%22%3E%24dresda%3C%2FVALUE%3E%3C%2FFIELDREF%3E%3C%2FEQ%3E%3C%2FWHERE%3E%3C%2FQUERY%3E%3C%2FVIEW%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20that%20%24dresda%20field%20assigned%20from%20another%20list%20item%20can%20be%20passed%20to%20the%20query%3F%20The%20objective%20is%20to%20read%20all%20the%20items%20in%20ListAA%20retrieve%20and%20update%20the%20matching%20one%20in%20ListBB%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-187375%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20a%20variable%20be%20coded%20in%20CAML%20powershell%20for%20Sharepoint%20online%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-187375%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Juan.%20Sorry%20for%20the%20delay%20in%20replying.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20discovered%20that%20CAML%20queries%20don't%20work%20on%20%26gt%3B5K%20big%20SharePoint%20lists%20so%20looking%20at%20other%20options..%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWill%20try%20when%20I%20get%20a%20chance.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-186064%22%20slang%3D%22en-US%22%3ERe%3A%20Can%20a%20variable%20be%20coded%20in%20CAML%20powershell%20for%20Sharepoint%20online%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-186064%22%20slang%3D%22en-US%22%3ESure...this%20is%20for%20OnPremises%2C%20but%20you%20can%20grab%20the%20portion%20of%20code%20you%20need%3A%20%3CA%20href%3D%22https%3A%2F%2Fgallery.technet.microsoft.com%2Foffice%2FHow-to-do-a-CAML-Query-6f5260cf%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgallery.technet.microsoft.com%2Foffice%2FHow-to-do-a-CAML-Query-6f5260cf%3C%2FA%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

$Items = Get-PNPListItem -List 'ListBB' -Query <View><Query><Where><Eq><FieldRef Name='fueltype'/><Value Type='Text'>$dresda</Value></Eq></Where></Query></View>

 

Is there a way that $dresda field assigned from another list item can be passed to the query? The objective is to read all the items in ListAA retrieve and update the matching one in ListBB

2 Replies
Sure...this is for OnPremises, but you can grab the portion of code you need: https://gallery.technet.microsoft.com/office/How-to-do-a-CAML-Query-6f5260cf

Hi Juan. Sorry for the delay in replying.

 

I have discovered that CAML queries don't work on >5K big SharePoint lists so looking at other options..

 

Will try when I get a chance.