Results 1 to 4 of 4
  1. #1
    Baz16 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2015
    Posts
    11

    Creating a Folder in Sharepoint, if it does not already exist


    Hi, I am trying to create a folder automatically if it does not exist already in sharepoint, the below code works fine for a shared drive, i just replaced the Path name with the URL ("https:\\etc...), but I keep getting bad file. I have tried changing the / to \ but to no avail. Is there an easy way to create a folder on sharepoint using VBA from an excel userform (i suppose it doesn't really need to check if the file exists as it should never already exist, i just thought it would be best to cover it just in case)
    PTFolderName = Me.TextBox1.Value

    If Dir("https://workspace.Test.com/uk/Fix%20and%20Recover/7_PMT_%20Attachments/2_PMT_Additional_Attachments/" & PTFolderName, vbDirectory) = "" Then

    MkDir "//workspace.Test.com/uk/Fix%20and%20Recover/7_PMT_%20Attachments/2_PMT_Additional_Attachments/" & PTFolderName"

    End If

    Thanks

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    If you have the drive mapped why not just use filesystemobject commands?
    Example:

    http://www.pcreview.co.uk/threads/au...point.3818095/

    Are you also checking the existence of all the parent folders of PTFOLDERNAME?

  3. #3
    Baz16 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2015
    Posts
    11
    I have checked all the parent folders, they are correct. I am not sure what you mean by using filesystemobject commands. I looked at the link you sent but i cannot see where the folder name goes.

    I am unable to use shared drives as everything alse for this project is stored on sharpoint and everything must be kept together.

    Thanks

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    if the sharepoint site (server) is local to you or on your network, you should be able to map it as a regular network drive and create folders accordingly. I do not know your network, you would have to ask your IT guys. If your sharepoint site is in the cloud or NOT local to you you may be out of luck unless. I haven't ever used sharepoint myself so I'm just suggesting options. I would think you would have to supply credentials because you're accessing an HTTPS (encrypted web locations require a username/password usually) and I don't know if you can pass credentials using MkDIR, I don't think you can though.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 08-05-2015, 12:04 PM
  2. Replies: 4
    Last Post: 06-27-2013, 12:29 PM
  3. VBA to create PDF and folder if doesn't exist!
    By crxftw in forum Programming
    Replies: 2
    Last Post: 08-08-2011, 08:53 AM
  4. Creating Viewport into a folder
    By dragondata in forum Access
    Replies: 2
    Last Post: 03-26-2010, 07:15 PM
  5. Replies: 0
    Last Post: 10-19-2009, 11:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums