Announcement

Collapse
No announcement yet.

Upload multiple files to sharepoint document libraries - $50

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Upload multiple files to sharepoint document libraries - $50



    Hi all,

    In range B2:B11, I have a list of filename paths e.g.

    C:\Documents and Settings\All Users\Documents\Folder1\File1.xlsx
    C:\Documents and Settings\All Users\Documents\Folder2\File2.xlsx
    C:\Documents and Settings\All Users\Documents\Folder3\File3.xlsx

    And so on.

    In range C2:C11, I have a lis tof the path to the sharepoint document library where each of the files in column B should be uploaded e.g.

    https://sharepoint.ap.intranet.xx.co...er1/File1.xlsx
    https://sharepoint.ap.intranet.xx.co...er2/File1.xlsx
    https://sharepoint.ap.intranet.xx.co...er3/File1.xlsx

    And so on

    I would like a code that will loop thru the range :

    1. Check existence of all the files in column B. Not all 10 cells have to be filled up but those that are filled up must be a valid path. If any of the file therein is not existing, an error message should popup and then the whole procedure be aborted.

    2. Upload each of the files in column B to their respective path in column C.

    3. For those files succesfully uploaded, a text "OK" should be placed on the corresponding column D.


    Here is what I have written so far with the little I know about VBA (code apparently does not work), just in case this helps in illustrating what I was trying to do.


    Code:
    Sub uploadtosharepoint()
    Dim fs As Object
    Dim oldPath As String, newPath As String
    Dim c As Range
    For Each c In Range("B2:B11")
    With c
        oldPath = .Value
        newPath = .Offset(0, 1).Value
        Set fs = CreateObject("Scripting.FileSystemObject")
        fs.CopyFile oldPath, newPath
    End With
    Next c
    
    End Sub
    Please email me at removed if you have further questions.

    Thanks
    Last edited by S M C; February 20th, 2012, 13:58. Reason: Removed Email ID

  • #2
    Re: Upload multiple files to sharepoint document libraries - $50

    As per the Terms and Conditions.
    PLEASE PAY (via PayPal) 10% of your cost to [email protected] BEFORE you post. Then pay the remaining 90% to the person who completes the job on completion.

    Comment


    • #3
      Re: Upload multiple files to sharepoint document libraries - $50

      Sorry, I missed that part. I will try to open a paypal account asap and send the money accordingly.

      Comment


      • #4
        Re: Upload multiple files to sharepoint document libraries - $50

        Thank you.

        Comment


        • #5
          Re: Upload multiple files to sharepoint document libraries - $50

          Hi,

          I'll have a look and revert back.
          Kris

          ExcelFox

          Comment


          • #6
            Re: Upload multiple files to sharepoint document libraries - $50

            10% received, thanks.

            Comment


            • #7
              Re: Upload multiple files to sharepoint document libraries - $50

              I won't able to complete this task. This project is still open.
              Kris

              ExcelFox

              Comment


              • #8
                Re: Upload multiple files to sharepoint document libraries - $50

                Hi

                I'll take a look tommorow (it's late here...)

                dr
                Cheers,

                dr

                "Questions, help and advice for free, small projects by donation. large projects by quote"

                http://www.ExcelVBA.joellerabu.com

                Comment


                • #9
                  Re: Upload multiple files to sharepoint document libraries - $50

                  Originally posted by rbrhodes View Post
                  Hi

                  I'll take a look tommorow (it's late here...)

                  dr
                  Hello

                  Dr goes first. If he's not taking it, then I will be available.

                  To just clean up the first code:

                  Code:
                  Sub uploadtosharepoint()
                      Dim c As Range
                      For Each c In Range("B2:B11")
                          FileCopy c.Value, c.Offset(0, 1).Value
                      Next
                  End Sub
                  It is cleaned up, not improved (error handling and so on).
                  That's for Dr :-)

                  Wigi
                  Regards,

                  Wigi

                  Excel MVP 2011-2014

                  For more Excel memes: visit http://www.wimgielis.com ==> English articles ==> Excel memes

                  -- Topics without [CODE] tags or a meaningful topic title, will be neglected by me (and probably many others as well) --

                  Comment


                  • #10
                    Re: Upload multiple files to sharepoint document libraries - $50

                    Hi all,

                    This is still open for anyone who would like to give it a shot...

                    Comment


                    • #11
                      Re: Upload multiple files to sharepoint document libraries - $50

                      Hello PATSYS

                      How would you upload the files if you were to upload the files manually?
                      Would you use Windows Explorer to copy/paste and overwrite, or would it be an FTP client or a batch process or ...?
                      I have not a lot of knowledge of this setup for Sharepoint, so coding this is not easy for me if I do not know how to approach the problem.

                      Don't know if Dr still wants to proceed on it?

                      Wigi
                      Regards,

                      Wigi

                      Excel MVP 2011-2014

                      For more Excel memes: visit http://www.wimgielis.com ==> English articles ==> Excel memes

                      -- Topics without [CODE] tags or a meaningful topic title, will be neglected by me (and probably many others as well) --

                      Comment


                      • #12
                        Re: Upload multiple files to sharepoint document libraries - $50

                        Originally posted by Wigi View Post
                        Hello PATSYS

                        How would you upload the files if you were to upload the files manually?
                        Would you use Windows Explorer to copy/paste and overwrite, or would it be an FTP client or a batch process or ...?
                        I have not a lot of knowledge of this setup for Sharepoint, so coding this is not easy for me if I do not know how to approach the problem.

                        Don't know if Dr still wants to proceed on it?

                        Wigi
                        Hi Wigi,

                        We manually upload files to sharepoint document library by simply going to the site (https://xx) and clicking on the UPLOAD icon. I have not tried drag and drop from windows explorer to sharepoint explorer view. Will try this and revert.

                        Please let me know if there is something else I can provide you with to help you out.

                        I made a little search on this a while back and this link might also provide you with some insights.

                        http://www.access-programmers.co.uk/...21#post1133921

                        The poster got it to work, though it is MS ACCESS.

                        Thanks

                        Comment


                        • #13
                          Re: Upload multiple files to sharepoint document libraries - $50

                          Hello

                          From the link you directed me to, it is the upper half that is most important.
                          While this works in Accessn we'll need to see if if works in Excel too.
                          I have no Sharepoint, I cannot test. Did you try to do the steps but then in Excel?

                          If that works, I could look at the code part in the topic.
                          Including the other requirements you had.
                          Regards,

                          Wigi

                          Excel MVP 2011-2014

                          For more Excel memes: visit http://www.wimgielis.com ==> English articles ==> Excel memes

                          -- Topics without [CODE] tags or a meaningful topic title, will be neglected by me (and probably many others as well) --

                          Comment


                          • #14
                            Re: Upload multiple files to sharepoint document libraries - $50

                            Originally posted by Wigi View Post
                            Hello

                            From the link you directed me to, it is the upper half that is most important.
                            While this works in Accessn we'll need to see if if works in Excel too.
                            I have no Sharepoint, I cannot test. Did you try to do the steps but then in Excel?

                            If that works, I could look at the code part in the topic.
                            Including the other requirements you had.
                            Hi Wigi,

                            There are several obstacles in going the solution in the link I posted.

                            First, it requires downloading and running a setup.exe which only IT administrators can do in our company.
                            2nd, will this have to be done for all the users whom potentially will use this upload tool that I am putting up? If so, then I think I will have to abandon this approach.

                            In the link I posted, there is a mention of mapping the sharepoint URL as a network drive. Perhaps you can look into the coding of this? Just tell me what I need to do to test it.

                            Here is another similar solution

                            http://www.excelforum.com/excel-prog...harepoint.html


                            Thanks
                            Last edited by PATSYS; March 5th, 2012, 09:31. Reason: Add more resource links

                            Comment


                            • #15


                              Re: Upload multiple files to sharepoint document libraries - $50

                              Hello

                              I have written code to map a network drive. The code will then copy a certain file to the drive, and remove the mapping after 3 seconds.
                              The letter Z is used to map. Please go through the code and change to suit.

                              Code:
                              Sub tst()
                              
                              Const sSource As String = "C:\testfile.xlsx" 'change to suit
                              
                                  With CreateObject("WScript.Network")
                                  
                                      .MapNetworkDrive "Z:", "\\FSERVER1\infomay" 'change to suit
                                      If Len(Dir(sSource)) Then CreateObject("Scripting.FileSystemObject").copyfile sSource, "Z:\"
                                      Application.Wait Now + TimeSerial(0, 0, 3)
                                  
                                      On Error Resume Next
                                      .RemoveNetworkDrive "Z:"
                                      On Error GoTo 0
                                  
                                  End With
                                  
                              End Sub
                              This code works fine for me, but I am not sure you will be able to adapt for Sharepoint. Not an expert there, sorry.
                              Regards,

                              Wigi

                              Excel MVP 2011-2014

                              For more Excel memes: visit http://www.wimgielis.com ==> English articles ==> Excel memes

                              -- Topics without [CODE] tags or a meaningful topic title, will be neglected by me (and probably many others as well) --

                              Comment

                              Working...
                              X