This got to be my 500th blogpost and I'm excited ! :). Started blogging since Oct 4, 2007 and it's been a good learning experience over these 6 years! Thanks for your support which encourages me to continue blogging!
I had been super busy this last month with a Go Live Project and also have done some exciting work over the past few months with Sharepoint and Dynamics AX 2012 Integration.
I have build this windows service which polls every 10 mins a Sharepoint Nintex workflow based list and retrieves necessary information from a Sharepoint List using Sharepoint 2010 REST Services to create and post a Vendor Invoice Journal in Dynamics AX 2012.
I will try and cover this in couple of posts with code snippets as and when I go.
So, the process is:
a. Windows Service polling every 10 mins
b. Retrieve information from a Sharepoint based workflow
c. Create Vendor Invoice Journals in AX
d. Post Journals in AX
e. Updates the AX Journal Id, Status and other relevant information back into Sharepoint
Tools/Technologies used in this project:
a. Dynamics AX 2012
b. Visual Studio 2010 Windows Service Project (VB.Net)
c. Sharepoint Server 2010
d. Sharepoint 2010 REST Services
So, let's jumpstart. this code snippet below does the job of retrieving information from a Sharepoint based List, it looks for an item in the list which has status of "In Progress" and picks it up.
Let me explain how the code works:
1. Function GetSPListVendorInvoiceInfo is a VB.Net function (this is part of my Windows Service Project) and it looks into a sharepoint list and retrieves the individual item for e.g. Below is a sample of how my Sharepoint list looks like.
2. Next step, I grab the URI of my custom Sharepoint List via the REST webservice * by calling GetSPWorkflowUri()
<!--Sharepoint Workflow URI This is DEV URI Need to change for PROD Sharepoint URI--> <add key="WfUri" value="http://servername:portnumber/workflows-staging/_vti_bin/listdata.svc" />
*Note - I will cover the Sharepoint 2010 based REST Services for List items in a separate post.
3. refitem = dc.WFLodgeClaim.
Expand("Reg").Expand("Bu0").Expand("Country1").Where(Function(i) i.Status = "In Progress").FirstOrDefault()
Then, I use the above LINQ call to query the list filtering out only the items which has a status of "In Progress"
Please watch out for this space as there is more to come.....