Second part I'll show you how to add new data to a list and reference you to the file that you've noted as a hyperlink before we proceed thanks to Fernando for posting this question to you know so.
That we can share it with our other viewers so I hope you know you find this useful I'm trying to make it as simple as possible so that you can follow along ok I'm going to close this for now now.
Before we begin like to save us some time I've created a SharePoint list called SP TV ok and this list has two fields basically title which comes by default as a single line of Tanks and.
The file link which is a hyperlink or a picture ok so this is what I have done and then the other thing I've put in here is the library called Li b-17 leap 17 and here I've tried loading these two.
Files by myself ok the other thing that we need to keep in mind here before we proceed is I'll show you like add a new data to the list so this is title this is single line of text but file link you.
Default ok so I put in some code together which will run it shortly the other thing we need to know here is in this library 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 a folder like this which is a network drive or library which you can directly use it as a folder ok so if you like - grayed out.
We'd open with explore is radon so if you want to find out the network drive for that simply copy this whole link basically this the SharePoint site with the name of the library and then just.
Replace all the replace all this for slice with backward slash like this and remove HTTP semicolon and hit enter so you'll get a folder like this okay and that's how you can get a network drive.
Like a folder which you can work directly ok so this is one thing and even though once you find this out just copy this link going back to my you know the small template or form that I've.
Posts Related:
Created here so this is going to be our
Title the filing and then the file caption that we want it to be you know for the link okay so I'm going to my editor the first thing I've written here.Is 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 photocopy so you see source as string and destination F.
String okay so you put in like let's say that you have a file called you know in feed Reichel X file dot 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 the parameters to execute this particular method okay so similarly we have created I mean I've created this the code together so what well you need to know here is one is the.
SharePoint library a string and then the local address s string so the library address is the one we just got now just put in there and then our local address is to put the full file name that you.
Want to upload it to the SharePoint ok so put in this and when you execute this is basically gonna take the library name folder pot and then concatenate it with the file name the file name that is the.
File name that is here which is e 9 dot PNG for example okay so if I run this right now file name with extension this function that basically just returned the name of.
The file from the hole from the file pot for example this so if I put in this for example if I execute this let's say that C is a 3 now this is d 6 so if I say D 6 it just gives me this so basically i'm.
Concatenating the file name with the SharePoint library that is going to be our destination path and then the local address is coming from here for example if I run this code now.
First I'm gonna disabilities okay if I
Run this code right now it's going to copy this file to this SharePoint library ok ok I hope I'm not going too fast.So this is gonna run this right now if I run this it will copy this file to a library here ok 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's a 9 which is this particular file ok and if I go back to my library in the web page you'll see there's v 9 there ok so that is how you can upload you know basically upload the file to.
Any library using VBA ok so one small thing that I've done in this particular upload is after the copy successful you know if it goes well then in B 11 which is this D 11 I return it or I put in the.
Value of the SharePoint library file name that we have processed okay but then here we need to always prefix HTTP with semicolon and then we need to have this because of the webpage.
Naming convention the file separators instead of backslash we need is to have forward slash okay and the other thing is whenever we want to append data to you know updated data or whenever we.
Passing the information from VBA to SharePoint we need to have the link you know with this hashtag you know 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 as in to update the data in the list it takes picks up this.
List okay and then this caption okay so one small thing I've added here before we cross it is if you click on this it basically runs this code it's a dialog box basically it will just show a dialog.
Box and you can select the file and then whatever you select will be put into d6 which is this d6 okay so that's right 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 the caption is this this is the file.
Caption in d8 and then this is in DL Evan 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.
Loaded so if you're following along with our you know VV basis we SharePoint working with VBA will be working with your point then you will find this very you know.
Familiar so here we are declaring the connection we are setting up a new connection with during the connection strings this is my SharePoint site and then this is my GU.
ID for the list and then basically it's opening with this cursor and log type and then we are putting title value is equal to this particular C and then D for text and then I'm saying that the.
File link the value of this our SharePoint list file link value is going to be this particular string so I put in two things here to variable one is the file caption and the file link so one I.
Actually at you know a penny I concatenate both of them so file link is going to be this one and the caption is this five concatenated both of them and like I said the link needs to go with.
The hashtag prefix and you know suffix okay so let's try this if I run this right now what is going to happen is if the upload you know basically if the code discord ran successfully is gonna.
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 have just uploaded okay so let's give it a try I'm just.
Going to select a new file call this one let's put 4 B 4 so if i refresh this you see there is only one record here in the list and then if I go to all items of the library you'll see a nine 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 that's two and this is a file the first one I want to upload.
This is the caption and this is going to be the link okay so I'm trying to click on this place a complete so this is the file that is put in as a link this at the caption this is the source.
Now that we want to load the file and then this is the cycle so if I go here and refresh before is there if I go to my library here and refresh from the web page you see e4 is there and if I go to.
My list you see test two this right there and if I click on click here for the file it should open up this page that we've just loaded so this is this is pretty simple.
You know but sometimes since whenever you need two things we might get stuck so you know just feel free to come and come back to me if you have any questions and please do not forget to.
Subscribe and you know like this video so that I can do more of these videos for all our viewers okay and do not forget like small things that I've said like you know the link needs to be you.
Know between the hashtags and then you know when it is loaded we need to have these things the code is doing all of this but you need to know if you have to design one for yourself so this is what.
I have for you right now we'll do more of these videos in you know coming in the coming upcoming videos so please watch out once again please subscribe and keep watching thank you and bye bye.