Xpath in XML Query for attachment file names of SharePoint Item

  • 14 August 2020
  • 3 replies
  • 14 views

Badge +1

Hi Everyone,

 

I'm trying to query attachment file names items in a SharePoint list. I've got the xml content I need (I think), but there's an "m: properties" item in front of the data I want (FileName). I tried searching various sources but couldn't figure out how to get around the "m:properties" to get to FileName. 

 

Based on some other posts, here's what I've tried so far with no luck: 

//d:FileName

- //*[local-name()=FileName]

 

Here's a snippet of the xml: 

<m:properties><d:FileName>IF_MIDAS_1page.pdf</d:FileName><

 

Can anyone help me handle the "m:properties" properly to get to the file name?  

 

Thanks!


3 replies

Userlevel 6
Badge +22
Hi,

Are you able to provide all the XML that you are working with?
Badge +1

Sure thing! It's attached now.

 

The api I'm using is: _api/web/Lists/getbytitle('ListTitle')/items(CurrentItemID)/AttachmentFiles

 

I could go one step further and do $select but it doesn't seem to get ,me out of the "m properties" thing. 

Userlevel 6
Badge +22
HI.

My test showed that the following Xpath Worked.
/defaultNS:feed/defaultNS:entry/defaultNS:content/m:properties/d:FileName

Reply