Create SharePoint Link Table Acess VBA

April 14th, 2014 No comments

Using Access we can connect to sharePoint list as a link table, the problem comes when we move from Development to further envionments.

Either we need to relink to the SharePoint list, if the link table has been created/connected using perticular view [which was possible in Access 2003] , then manual relinking also not possible.

here are the code snippets which I used to Create a new SharePoint link table programatically.

first we need to find the list guid using shaerPoint web service list.asmx

Dim MasterTypeList As String
Dim MasterTypeListGuid As String
Dim MasterTypeAllItemsView As String
Dim MasterTypeTable As String

'SharePoint List Name
MasterTypeList = "MasterTypeList"
'Acess linked table name [Right click on acess table and see the properties]
MasterTypeTable = "MasterTypeLine: All Items"

MasterTypeListGuid = getListGuid(MasterTypeList)

then we need to use views.asmx to find the guid related to perticular view.

Set oXMLDoc = New DOMDocument
Set ListCollectionNodeList = ws.wsm_GetViewCollection(MasterTypeList)
oXMLDoc.loadXML (ListCollectionNodeList.Item(0).XML)
MasterTypeAllItemsView = oXMLDoc.selectSingleNode("//Views/View[@DisplayName='All Items']").Attributes.getNamedItem("Name").Text

once we get the view guid then we need to use

Dim db As Database
Set db = CurrentDb
' Delete the existing link
CurrentDb.TableDefs.Delete (MasterTypeTable)
Call CreateNewLinkTable(EnvPath, MasterTypeTable, MasterTypeListGuid, MasterTypeAllItemsView)

CreateNewLinkTable is a subroutine, EnvPath is your sharePoint site Link for eg http://dev7637/sites/GRM/

Private Sub CreateNewLinkTable(EnvPath As String, TableName As String, ListGuid As String, ListViewGuid As String)
Dim db As Database
Set db = CurrentDb
Dim TempLinkTable As TableDef
Set TempLinkTable = CurrentDb.CreateTableDef(TableName)
TempLinkTable.Connect = "ACEWSS;HDR=NO;IMEX=2;DATABASE=" & EnvPath & ";LIST=" & ListGuid & ";VIEW=" & ListViewGuid & ";RetrieveIds=Yes"
TempLinkTable.SourceTableName = TableName
db.TableDefs.Append TempLinkTable
Set db = Nothing
End Sub

we are done. Hope it helps some one..

Categories: Acccess, Sharepoint2010, webservice Tags:

Start K2 blackpearl Workflow Programmatically tutorial

October 24th, 2013 2 comments

Hello, this is the second part to K2 workflow series.

If you have not read the first part please read it at

In this part we will see how to see start the workflow which we have deployed to K2 server.
Read more…

Creating k2 BlackPearl workflow

October 23rd, 2013 3 comments

We will be creating very basic workflow using k2.

Our final workflow will look like below.


Looks pretty.. :)

lets see how to create it.
Read more…

K2 Workflow Basics

October 21st, 2013 1 comment

Working with K2 is very easy, but Open resources such as blogs are very less which give complete information about K2 and K2 workflow.

So I have decided to share information regarding K2 workflow, I hope it will help people are new or want to know learn K2 workflow.

I will share information in three parts.

1) Creating k2 blackpearl workflow tutorial.

2) Starting  K2 blackpearl Workflow programmatically tutorial.

3) Creating Task forms for K2 workflow.

4) Passing data from K2 workflow to task forms and vice versa.

here I’m assuming that you have K2 environment set up.

if you don’t have K2 environment. you can register at

once you successfully register , they will prepare a environment[remote desktop] for you which you can use for 30 days.

Happy Coding

Categories: c#, K2, Workflow Tags:

Move file from Document library to another programmatically

October 19th, 2013 No comments

Hello in my recent task I had to move documents from one document library to another document library.

I used below snippet to achieve the same.

below code moves documents from Docs [ from document library] to EDcos [To document Library]

       static void Main(string[] args)
            using (SPWeb myweb =  
new SPSite("http://localhost:40181/").OpenWeb())
                SPList docs = myweb.Lists["Documents"];

                SPListItem item = docs.GetItemById(7);

                SPList EDocs = myweb.Lists["Edocs"];

                var myfiles = from SPListItem listitem in EDocs.Items
                                where listitem.File.Name.Equals(item.File.Name)
                                select listitem;
                if (myfiles.Any())
                    SPFile myfile = myfiles.First().File;
                    if (myfile.CheckOutType == SPFile.SPCheckOutType.None)

                    myfile.CheckIn("checked in using code");
                                     + "/" + item.File.Name);


Simple, it’s it.

Happy coding

Document Published Event Document library

October 19th, 2013 No comments

In my recent task I had to write some business logic when item was getting published, first thing which came to my mind was event receiver , but there was no such event called as ItemPublished,

solution was simple, I achieved it using below snippet.
Read more…

Replace DispForm.aspx for list or content type.

October 19th, 2013 No comments

Every Custom SharePoint List is attached to a [item]content type which has its own

Display form [DispForm.aspx]

Edit form [EditForm.aspx]

New form [NewForm.aspx]

Read more…

Check In a document programmatically.

October 19th, 2013 No comments

Hello in my recent task I had to check in Files which were checked out by users now there were some business rules for either checking in the files or undoing checkout.

I used below code snippet to achieve the task.
Read more…

Changes To your machine when you install SharePoint

October 19th, 2013 No comments

When you Install SharePoint server 2010 on your machine , it makes certain changes to your file system , Adds new sites to your IIS server also creates new Databases in your DB , so what are those changes exactly.
Read more…

How to view SharePoint 2010 Runtime Errors

October 19th, 2013 No comments

If your custom code runs into an error, by default
SharePoint will log that error and it will present the user with a generic error through the browser. In order to view the actual error message through the browser, you will need to make three changes to your web.config
Read more…