Skip to main content
Solved

FME - Sharepoint Library On-Prem


benhanson
Contributor
Forum|alt.badge.img+2

Can FME create folders in an on-prem Sharepoint Library? I’m successfully connecting to the library using the Sharepoint List type (Reader and Writer), and looking at written data I can see an existing folder, but I can’t use the writer to create folders.

Best answer by benhanson

I did test without it, and the request failed so I was trying to eliminate variables.

I determined the problem however. It turns out that for nearly all POST requests to the Sharepoint API, you must supply the custom header X-RequestDigest with a value acquired by sending a POST to /_api/contextinfo.

So my initial test workflow (which is now working) consists of Creator(Transform to start flow) → AttributeFileReader(Transformer to pull in test file) → HTTPCaller(Transformer to get XML containing RequestDigest) → XMLFlattener (Transformer to extract & expose FormDigestValue) → HTTPCaller (Transformer to make actual REST call to Sharepoint).
 

View original
Did this help you find an answer to your question?

10 replies

j.botterill
Influencer
Forum|alt.badge.img+40
  • Influencer
  • June 4, 2025

Safe software have a great article for Getting-Started-with-Microsoft-SharePoint but alas the majority focus’ around using Sharepoint Online, hence the Connector transformer.

Having a quick look at the sharepoint documentation,  appears you might be able to use the same API. d http://server/site/_api/ so you should be able to substitute the first part of the url with your internal address

https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-to-know-the-sharepoint-rest-service?tabs=csom


benhanson
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • June 4, 2025

Would this be using the HTTPCaller transformer? Does this end up looking like 1 workflow step per API call? (one httpCaller to auth and/or get context, separate to loop through with updates?)


j.botterill
Influencer
Forum|alt.badge.img+40
  • Influencer
  • June 4, 2025

I can imagine that would be the case. The sharepointonlineconnector is an fme package with the following actions build into a UI

uploads, downloads, deletes, or lists the contents of files https://hub.safe.com/publishers/safe/packages/microsoft-sharepoint/transformers/SharePointOnlineConnector

underneath all its doing is auth and graph/SharePoint API calls


benhanson
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • June 4, 2025

Do you know of any samples out there that show POST operations from HTTPCaller to Sharepoint? I’ve successfully queried a folder with GET /_api/web/GetFolderByServerRelativeUrl('MyLibraryName'), but this GET request doesn’t require constructing a request body, and doesn’t appear to require any special headers. I’m not having any luck with POST operations (like what headers, what's in the upload?)


j.botterill
Influencer
Forum|alt.badge.img+40
  • Influencer
  • June 4, 2025

benhanson
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • June 4, 2025

What’s missing is how do I plug in 

{length of request body as integer}

within the HTTPCaller header parameters?


j.botterill
Influencer
Forum|alt.badge.img+40
  • Influencer
  • June 5, 2025

you can dive more into the detail of HTTP-Requests-with-the-HTTPCaller where the Header value goes here 

 


benhanson
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • June 10, 2025

I understand where the custom headers go, the issue is how to calculate the request body length in order to populate the value.


birgit
Influencer
Forum|alt.badge.img+16
  • Influencer
  • June 10, 2025

Are you sure that that header is required? I myself have never had a need to actually manually use this header in a httpcaller. I don't know if that is because it is not required or if it is something that all calls need and is therefore always added automatically. Can you try the call without this header?


benhanson
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • Best Answer
  • June 12, 2025

I did test without it, and the request failed so I was trying to eliminate variables.

I determined the problem however. It turns out that for nearly all POST requests to the Sharepoint API, you must supply the custom header X-RequestDigest with a value acquired by sending a POST to /_api/contextinfo.

So my initial test workflow (which is now working) consists of Creator(Transform to start flow) → AttributeFileReader(Transformer to pull in test file) → HTTPCaller(Transformer to get XML containing RequestDigest) → XMLFlattener (Transformer to extract & expose FormDigestValue) → HTTPCaller (Transformer to make actual REST call to Sharepoint).
 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings