VBA to upload file to Internet or SharePoint. SharePoint Automation using VBA - 8

VBA to upload file to Internet or SharePoint. SharePoint Automation using VBA - 8 [Music] hello and welcome back everyone to bva to Z in this short video I'll be showing you how to upload the file to SharePoint Library using bva and the second part.

VBA to upload file to Internet or SharePoint. SharePoint Automation using VBA - 8

I'll show you how to add new data to a list and reference it to the file that you've loaded as a hyperlink uh before we proceed thanks to Fernando for posting this question to you know so.

That we can share it with or of viewers so um I hope you know you find this uh useful I'm trying to make it as simple as possible so that you can follow along okay I'm going to close this for now now.

Um before we begin like uh to save us sometime I've created a Sho list called sptb okay and this list has two Fields basically title which comes by default as a single line of text and the file.

Link which is a hyperlink or a picture okay so this is what I've done and then the other thing I've put in here is the library called lib 17 lip 17 and here.

I've tried loading these two files by myself okay the other thing that we need to keep in mind here before we uh proceed this um I'll show you like uh add a new data to the list so this is.

Title this is single line of text but file link you have to pause two things here one is the c ction and like the the like the description and then the web address and the web address needs to.

Start with HTTP semicolon and this so which comes by default okay so I put in some codes together um which will run it shortly um the other thing we need to know here is um in this Library um when.

You go to the library options you'll see open with Explorer so when you click on this you'll be able to see um a folder like this which is a network drive or Library which you can uh directly use it.

As a folder okay so if you like mine is great out with open with Explorer is great out so if you want to find out um the network drive for that simply copy this whole link uh basically this uh the.

SharePoint site with uh the name of the library and then um just uh replace all the replace all this uh for slash with backward.

Slash like this and remove HTTP and semicolon and hit enter so you'll get a folder like this okay that's how you can get a network drive um like a folder um which you can work directly okay so this.

Posts Related:

    Is one thing you need to know uh once

    You find this out just copy this link um going back to my you know uh the small template or form that I've created here so this is going to be our title the.

    File link and then the file caption that we want it to be uh you know for the link okay so I'm going to my editor uh the first thing I've written here is uh upload the SharePoint basically here.

    What you need to know is the function call or the method file copy so if I put in this for example file copy so you see source s string and destination s string okay so you put in like.

    Uh let's say that you have a file called you know in C drive called um X file.txt whatever it is and you want to copy this to some other folder let's say d so this is how you pass in you know um the.

    Parameters um to execute this particular method okay so similarly we have created um I mean I have created this um the code together so what you need to know here.

    Is one is the SharePoint Library a string and then the local address as string so the Library address is the one we just got now just put in there and then.

    Um our local address is the part uh the full file name that you want to upload it to the SharePoint okay so put in this and when you execute this uh it's basically going to take the Library name.

    Folder PA and then uh concatenate it with the the file name the file name that is the file name that is here which is e 9.png for.

    Example okay so if I run this right now uh file name with extension is function that that basically just return the name of the file from the whole from the file path for example this so if I put in.

    This for example if I execute this uh

    Let's say that um see is I see now um this is D6 so if I say D6 it just gives me this so basically.

    I'm concatenating the file name with the SharePoint library that is going to be our destination PA and then the local address it is coming from here so for example if I run this code now first I'm.

    Going to just delete this okay if I run this code right now it's going to copy this file to this uh SharePoint Library okay okay I hope I'm not going too fast.

    So I'm just going to run this right now if I run this it will copy this file to a library here okay so let's try this so I'm going to run this okay it's done so if I go here and refresh this you'll see.

    There is E9 which is this particular file okay and if I go back to my library in the web page you'll see there's E9 there okay so um that is how you can uh upload you know basically upload the.

    File to any Library using BV okay so one small thing that I've done in this particular upload is uh after the copy successful um you know if it goes well then in the1 which is this in d11 I uh.

    Return it or I put in the value of the SharePoint uh Library file name that we have processed okay but then here we need to always prefix HTTP with semicolon and then.

    Um we need to have this uh because of the web page uh naming convention the file uh separators instead of back slash we need it to have for for slash okay and the other thing is whenever we want.

    To append data to you know update the data or whenever we passing the information from BBA to SharePoint we need to have the link you know with uh this hashtag you know uh before and.

    After the link okay so this is what this is kind of a preparation that I'm doing right now so that it logs the you know the link here so that whenever we run the code to upload it later on uh as in.

    To update the data in the list it take picks up this list okay and then this caption okay so uh one small thing I've added here before we proceed is if you click on this um it basically runs this.

    Uh code um it's a dialogue box basically it will just show a dialog box and you can select the file and then what whatever you select will be uh put into D6 which.

    Is this D6 okay so let's try so I select click on this and I can select whatever file I want and click on okay and then it returns whatever I selected here okay so all the codes and everything will be.

    Available in the video description for you to download it um the caption is this uh this is the file caption in d8 and then this is in D1 this is the actual file that I'll be appending into.

    The list so that when the user clicks on this it will take me to that particular file that we have uploaded so if you're following along with our you know VV a toz SharePoint working with VBA uh VBA.

    Working with SharePoint then you will find this very um you know familiar so here we are declaring the connection we are uh setting up a new connection we putting the connection strings uh this.

    Is my SharePoint site and then this is my my gu ID for the list and then basically it's opening with this um curser and log type and then we are putting title value is equal to this.

    Particular sheet and then D4 text and then I'm saying that the file link the value of this um our SharePoint list file link value is going to be um this particular.

    String so um I put in two things here two variables one is the file caption and the file link so when I actually uh you know ien it I concatenate both of them so file link is going to.

    Be this one and the caption is this so I've concatenated both of them and like I've said uh the link needs to go with hasht prefix and uh you know uh suffix okay so let's try this uh if I run this.

    Right now what is going to happen is U if the upload you know basically if the code this code run successfully is going to run this code it will continue to run this code and it will add a new data to.

    The SharePoint and then link this file to the one that you've just uploaded okay so let's give it a try um I'm just going to select a new file we'll call this one uh let's put four.

    E4 so if I refresh this you see there's um only one record here in the list and then if I go to uh all items of the library you'll see E9 is the file that is available right now so if I click on.

    This now I'm expecting this particular information to be loaded I'll make it this title test two and this is the file E4 is the one I want to upload um this is the caption and this is going to be.

    The link okay so I'm trying to click on this so you say complete so this is the file that is um put in as a link this is the caption this is the The Source you know.

    That we want to load the file and then this is the title so if I go here and refresh E4 is there if I go to my library here and refresh in the web page you see E4 is there and if I go to my.

    List you see test to is right there and uh if I click on click here for the file it should open up this page that we've just loaded so this is um this is pretty simple you know but sometimes since uh.

    Whenever you're new to things you might get stuck um so you know please feel free to com in come back to me if you have any questions and uh please do not forget to subscribe and you know like.

    This video so that I can do more of these videos for uh all our viewers okay and do not forget like like small things that I've said like uh you know um the link needs to be you know.

    DISCLAIMER: In this description contains affiliate links, which means that if you click on one of the product links, I'll receive a small commission. This helps support the channel and allows us to continuetomake videos like this. All Content Responsibility lies with the Channel Producer. For Download, see The Author's channel. The content of this Post was transcribed from the Channel: https://www.youtube.com/watch?v=LLxM7cekToU
Postagem Anterior Próxima Postagem