Results 1 to 11 of 11
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919

    Error 53 and 76 trying to copy file to Sharepoint

    Can't find any forum threads that might have answer(s) to the difficulty I'm having trying to copy a file to a Sharepoint. In the app's settings we have this:


    Click image for larger version. 

Name:	000.jpg 
Views:	19 
Size:	39.9 KB 
ID:	47815

    The code that accesses the URL from "Settings" and attempts the copy:
    Code:
    Private Function UploadToSharepoint() As Integer
    
    
        Dim strShrPt As String
        Dim FS As Object
        
    On Error GoTo Err_Handler
    
    
        strShrPt = Nz(DLookup("SetShrPt", "QSettings"))
        If Len(strShrPt) = 0 Then
            MsgBox "No ""Sharepoint"" address found in ""Settings""" & vbNewLine & _
                   "Copy " & strLSName & " to ""Hub"" manually."
            Exit Function
        Else
            strShrPt = strShrPt & strTxtName
        End If
    
    
        Set FS = CreateObject("Scripting.FileSystemObject")
    
    
        If FS.FileExists(strLSName) Then
            FS.CopyFile strLSName, strShrPt
            UploadToSharepoint = 0
        End If
        
    Exit_Handler:
       Exit Function
    Err_Handler:
       MsgBox "Error " & Err.Number & " copying " & strTxtName & " to ""RR Hub"" : " & Err.Description
       MsgBox strShrPt & vbNewLine & strShrPt
       UploadToSharepoint = Err.Number
       Resume Exit_Handler
    End Function
    The one thing that makes this whole caper a bit difficult, at least from the standpoint of debugging, is that it's only the customer that has security to the Sharepoint. HOWEVER, when the user does a copy/paste of the URL expression you see above from "Settings" directly into her browser's address bar, the Sharepoint opens up normally. So, I expect the copy to fail on my machine, just not sure what error to receive, one about a path or more about security like enter user name and password for the Sharepoint.

    On my machine, I get either this error:
    Click image for larger version. 

Name:	001.jpg 
Views:	19 
Size:	17.8 KB 
ID:	47816 OR THIS ONE: Click image for larger version. 

Name:	002.jpg 
Views:	19 
Size:	22.4 KB 
ID:	47817

    Click image for larger version. 

Name:	003.jpg 
Views:	19 
Size:	29.5 KB 
ID:	47818

    I can find nothing wrong with string configuration or the FS Object, though I don't have a whole lot of experience with the file system model. Any suggestions?
    Thanks,
    Bill

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,933
    And what happens when you paste the url into your browser?
    Little puzzled as how you expect to copy a file (even test to copy a file) when you do not appear to have access?

    After a quick Google, a slightly different method.
    https://sharepoint.stackexchange.com...ia-commandline

    However you still need access of course.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    And what happens when you paste the url into your browser?
    I get a sign-in prompt.

    Little puzzled as how you expect to copy a file (even test to copy a file) when you do not appear to have access?
    I'm expecting to get a sign-in prompt when attempting to copy while on my computer. If I reach that level of success, I'll at least believe my app will run on the customer's machine.

  4. #4
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Try replacing the forward slashes with backslashes;

    Code:
    Function fnURLtoUNC(strURL As String) As String    
        fnURLtoUNC = Replace(strURL, "https://", "\\")
        fnURLtoUNC = Replace(fnURLtoUNC, "/", "\")
    
    
    End Function
    Good luck permissions and SharePoint/OneDrive are a pain.

    If they give you a login if you open the site in Internet Explorer beforehand, it will save a temporary local security token and allow you to use FSO with the UNC.
    The token lasts a number of days, but needs IE opening regularly on the page to keep it "alive".

    If they are using Windows 11 it won't work as IE doesn't ship with it
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    \\revelcommunities.sharepoint.com\sites\thehub-revel-rancharrah\LifeStyles\
    I've tried the sharepoint address both ways, "/" and "". I did find one site that discussed the slash orientation differing on whether the user's sharepoint site used HTTPS versus http:. There was no difference to the errors encountered with either of the orientations. Maybe you can garner more out of this site than I did: https://pholpar.wordpress.com/2016/0...-vba-and-rest/ I did add both the references mentioned in the "pholpar" descriptions.

  6. #6
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    I'll be honest if the FSO can't locate the path it normally gives you a more obvious error.
    And I wouldn't rely on it bring up a login option for the SharePoint site.

    You have to get the \\YourSharePoint@SSL\DavWWWRoot\
    security token stored to get it to work.

    I've been working on a similar problem with a client for 2-3 days, now and have had to involve their IT dept.
    I have permissions and can create the folders required in VBA code. Some of the end users can't and I don't know why.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  7. #7
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    And I wouldn't rely on it bring up a login option for the SharePoint site.
    Yes, this was a wild expectation, as it seems also about a more descriptive error.

    What would constitute a "security token"? Logon ID and password?

  8. #8
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,933
    Try that other method I posted, but you still need logon credentials.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  9. #9
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    but you still need logon credentials
    That's okay as long as the prompt appears for the user as the FSO executes.

    I have a little medical issue the rest of the day, but I'll try your suggestion tomorrow or Friday depending on how the day goes. What was the post # so I don't loose track of things.

  10. #10
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,933
    Post #2 plus extra chars so I can post.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  11. #11
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    I'll have an opportunity on Saturday on the user's machine to try "LazyAdmin's" approach using a mapped network drive. It might very well have the advantage in that one can specify a user name and password for the sharepoint server using the "Net Use" UI. We'll see................

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

Similar Threads

  1. Replies: 0
    Last Post: 05-12-2022, 12:48 PM
  2. Replies: 0
    Last Post: 03-18-2017, 03:40 AM
  3. Replies: 0
    Last Post: 03-24-2014, 09:35 AM
  4. Importing file directly from a Sharepoint file (not list)
    By jstoler in forum Import/Export Data
    Replies: 1
    Last Post: 06-28-2013, 01:44 PM
  5. Replies: 0
    Last Post: 07-31-2012, 10:33 PM

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