It looks like you should be able to use Business Connectivity Services by pointing it to a NSQL query which delivers your resource ODATA . The authentication to use the NSQL might give you a little problem but it looks like you can build a .NET Connectivity Assembly that would allow you to overcome any authentication issues that you might run into.
I am not sure this will help but this would be a pretty simple one way interface.
In my younger days, I built a few SharePoint integration. SharePoint has an extensive API for handling such tasks. Depending on where you are storing the resource data (a list or maybe a shared Excel document), it is pretty straight forward.
I would approach it this way:
- Build a NSQL to get the resource data that you desire. This provides you a Query web service and the wsdl url for getting the required resource data.
- The SharePoint List wsdl url or shared xlsx document wsdl url depending on where you want to store the resource data is available.
- Generate client stubs for the NSQL and Sharepoint web services.
- Build a simple console application that queries Clarity for the resources and the current SharePoint list. Loop through the Clarity resource records comparing them to the ones in the SharePoint list. Update existing resource with records that have changes, Add new resources to the list and Delete any resources in the list that are no longer in Clarity.
- Schedule the console application to run on given schedule.
The console application looks something like this:
using System;
using System.Linq;
namespace TestResourceSharePoint
{
public class Program
{
public static void Main(string[] args)
{
var p = new Program();
p.SyncResource();
}
public void SyncResource()
{
try
{
// Generated from the Query WSDL for my NSQL query log into Clarity
var clarityQuery = new ClarityQuery.GeneResouceQueryQueryService();
var login = new ClarityQuery.Login { Username = "admin", Password = "password" };
var sessionId = clarityQuery.Login(login);
clarityQuery.AuthValue = null;
if (String.IsNullOrEmpty(sessionId)) clarityQuery.AuthValue = new ClarityQuery.Auth { SessionID = sessionId };
if (clarityQuery.AuthValue == null) Environment.Exit(-1); //Didn't login into Clarity
// Preform the query against Clarity
var geneResouceQuery = new ClarityQuery.GeneResouceQueryQuery { Code = "GeneResouceQuery", Filter = new ClarityQuery.GeneResouceQueryFilter() };
var geneResouceResult = clarityQuery.Query(geneResouceQuery);
if (geneResouceResult.Records.Any()) //Only update if we have any resouce records
{
// Set up our sharepoint get our resource list items
var sharePointList = new SharePoint.Lists {UseDefaultCredentials = true};
var doc = new System.Xml.XmlDocument();
doc.LoadXml("<Document><Query /><ViewFields /><QueryOptions /></Document>");
var listQuery = doc.SelectSingleNode("//Query");
var listViewFields = doc.SelectSingleNode("//ViewFields");
var listQueryOptions = doc.SelectSingleNode("//QueryOptions");
var resouceListItems = sharePointList.GetListItems("Resources", String.Empty, listQuery, listViewFields, String.Empty, listQueryOptions, null);
// Check for update and new resources
foreach (var geneResouceRecord in geneResouceResult.Records)
{
//
// Add logic to see if each geneResouceRecord is in the list or needs to be addded
// If exists then update the field values in the resource item
// otherwise add a new resouce item to the list
//
}
// Remove resouces that are no longer in the Clarity Query results
foreach (var resouceListItem in resouceListItems)
{
//
// Add logic to see if there is a resouceListItem that doesn't exists in geneResouceResults.Records
// If there isn't a matching record then delete the resouceListItem from the resourceListItems
//
}
sharePointList.UpdateListItems("Resource", resouceListItems); //Update the sharepoint list
}
clarityQuery.Logout(sessionId); //Log out of Clarity
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
V/r,
Gene