Create Sharepoint Online folder from VBA (access 2016) (1 Viewer)

Pat_M

New member
Local time
Today, 22:30
Joined
Oct 12, 2019
Messages
3
I am a newcomer to SharePoint Online and I am trying to add a subfolder to a SharePoint Document Library from Access 2016 using VBA.

As this is my first post here I cannot add links to a recent post in Stack overflow "Create Sharepoint folder from VBA (access 2016)" which seems to be exactly what I need but...

Could anyone give a fuller example of the code needed to achieve this?
What API do I need to reference and how.
What references do I need in the access database: Microsoft Scripting Runtime, Microsoft XML, V6.0, VBA-JSON v2.3.1 module?
Also what url I would need to specify if the top level documents are located in this type of path:
h ttps://SampleName.sharepoint.com/sites/sitename/Shared Documents/

Thank you.
 

isladogs

MVP / VIP
Local time
Today, 22:30
Joined
Jan 14, 2017
Messages
18,186
Hi Pat.
Welcome to the forum
Have you tried asking at SO as well?
If you copy the SO link here, one of the mods can edit your post and make it an active link
 

isladogs

MVP / VIP
Local time
Today, 22:30
Joined
Jan 14, 2017
Messages
18,186
Thanks.
I can't help you with SharePoint as I've never used it.
However others will I'm sure be able to advise.

As for which APIs and references you may need, that will depend on what you're trying to do. For example, are you intending to work with XML or JSON files?

The more precisely you can explain your requirements, the more focused the responses will be.
 

Pat_M

New member
Local time
Today, 22:30
Joined
Oct 12, 2019
Messages
3
I only need to create the subfolder in sharepoint online. I can make use of a linked sharepoint list to access the contents of the folder afterwards.

So the sample code from the SO post should be all I need, but I am missing how to get it running:

strPostData = "{ '__metadata': { 'type': 'SP.Folder' }, 'ServerRelativeUrl': '/Shared Documents/Folder1'}"

'Set objXMLHTTP = New MSXML2.XMLHTTP
With objXMLHTTP
.Open "POST", url, False

.setRequestHeader "accept", "application/json;odata=verbose"
.setRequestHeader "Content-Type", "application/json;odata=verbose"
.send strPostData
strResponse = .
responseText
End With
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:30
Joined
Oct 29, 2018
Messages
21,358
Hi. In some cases, it seems simply using the MKDIR command is enough. Have you tried it?
 

Users who are viewing this thread

Top Bottom