VBA to add data to SharePoint. ADO and SQL. SharePoint Automation using VBA - 3

VBA to add data to SharePoint. ADO and SQL. SharePoint Automation using VBA - 3 Everyone will come back to BB A to Z this video we're gonna talk it's a follow up we're gonna talk about how to add a data to the SharePoint list that we have created in our last video we.

Talked about how to sync the data from SharePoint and in this video we'll talk about how to write the data to the SharePoint using this video method so first we're gonna create a small dataset.

Okay so this R or this is a dataset for example I'm just gonna come back to order or you know workbook or exercise workbook okay so this are the field and then these are inputs for example and.

Then it's gonna make this a little bit more realistic so let's try to fit in this information let's try to make it symbol as possible so that you get the basic things right and then you'll be.

Able to do anything by yourself later on so first thing what I'm gonna do is just gonna make this gonna copy this code that we used earlier and insert a new module and then paste this then I'll.

Call this add new item okay everything remains the same here I'm just gonna say that I want to open the whole table so select all from this table that we've created the connection string remains.

VBA to add data to SharePoint. ADO and SQL. SharePoint Automation using VBA - 3

The same this is read write as well as you know this connection string is available for you to make changes as well as to retrieve.

The information so here we're gonna make we're gonna say that I want to open it dynamically and I want to lock it optimistic so that's what you use when you have to make you know when you have.

To open the table in right mode so this is close the table and connection and clean the memory okay now we'll just get rid of this this is just open you know to retrieve the information which we.

Used earlier this is gonna just string off all this so when you have to add a new your item to the database you have to use add new method okay so RS T dot add new and then you can say that RSP if.

You have the field names like this it's pretty simple you can just put all of them and then I'll just add rst like this in front of all of them will make changes to that in a moment.

First I'll make it in this manner so for example if I want to refer to the field names in that particular table I can reference this manner as well and there are other ways to do that for example.

Posts Related:

    You can refer as our C dot field and

    Then you put in the field name here for example city name like that and then you put in the value that you want to send okay.

    So like New York for instance so this you can use this convention when you have like Department and then the name like this with the space and all but normally in this scenario since we only.

    Have one word right without any space it's easier to you know just write it in this manner it's faster so I'm just gonna leave this in comment if you have to use this.

    So in division here I have this is C 3 so this is 3 3 I want to put it to C 3 value or you can just write C 3 you can also say range C 4 dot value so there are different ways you can say that ok.

    So if you have to refer to specific she let's call this input then you can also say that CH you can also see in this manner so it is it has stuff you know if you just say this whenever you run this.

    Code whatever tab it is it's gonna just pick up you know C 3 dot value so just be sure to put in this manner though this C 3 w is the simpler way to do this so this is C 3 and then C 4 C 5 and then.

    C 6 7 8 and 9 so let's go back and check it so it's still 9 so 3 4 5 6 7 8 9 so basically what we're trying to do is we're gonna add North America to division rst division value is equal to.

    This so we're saying add a new item and then this particular fill input this particular figure whatever is inputted here ok so let's try to run this and see if it works.

    So we'll call this New York okay I'm gonna go this as data center and then come salaries and then we're done just put in some figure no if I run this I am hoping that this particular value is.

    Gonna be written into here so if you go

    Back to the list you'll see that there are 29 records in this particular table so I'm gonna go back here and then let's try to run this curve operation is not.

    Allowed in this context let's see what is that okay so most probably this is not allowing us to close it so let's try to put update here I think we just need to add back okay let's try to run this.

    Again let me just refresh or side again still 29 so that means it is not added now running this all right now let me rephrase this so it's 30 records that means it is it has upended the data that.

    We sent so if you look here's data center and why comes out and then this so this particular information that we have inputted here is too loaded using your script to our web this sharepoint.

    So let's try to do one more we'll call this MJ and then data process and just put it come again so jammed and so if I go and run this again if i refresh this you'll see that this.

    Particular line is now added so this is a simple way of using at new method you know the right back to the sharepoint server if you have to happen more data there are multiple ways to do that which.

    We'll explore in coming videos i if you're not able to follow along with this one i think i think you have to watch the first video that is on the a do so try to you know go to my channel.

    And then to the videos then you'll be able to see you know all the videos are arranged in that manner so that you'll be able to follow along if you have any questions please feel free to email me.

    Or just put in a comment and then i'll talk to you i'll come back to you as soon as possible thank you so much for watching tune in back for our next video bye.

    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 continue tomake 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=1qu6u2x7Kms
Previous Post Next Post