Link to home
Create AccountLog in
Avatar of phonepagerfax
phonepagerfax

asked on

How do I use SharePointEditor meta data in a MS Access 2010 Data Macro?

I have a data macro that logs data updates from one table (Tasks) to an Audit Trail table.  As part of the log record I want to include the User who performed the change.  I’ve found reference to the SharePointAuthor and SharePointEditor meta data that are fields added to tables published from MS Access 2010 into SharePoint 2010.

If I create a query against the Tasks table in the access database that the tables are linked to I see the SharePointAuthor and Editor columns and in the query results the User Name is displayed however, when I reference these meta data column in a data macro it returns a 9, which I assume is some SharePoint User ID.

Is there a function or a method to convert this id to a name that is web database compliant?

Thanks in advance,

Jim
Avatar of Rajendra Shekhawat
Rajendra Shekhawat
Flag of India image

Hi,

In the initial operation itself, you should update the username as required, instead of ID.
You can write a custom SharePoint Timer Job, you can update the required audit table at different time internals by matching tasks and getting user details from SharePoint object model.

I hope it helps.

Cheers.
Rajendra Shekhawat
Avatar of phonepagerfax
phonepagerfax

ASKER

Raj,

I’m not updating the Username or “SharePointEditor” meta data value, I’m trying to retrieve it.  What I’m asking is how do I retrieve the same value in a Data Macro that I retrieve in a query result when referencing the same field on the same record in the same table?  Outside the DM I get a text string displaying the User’s name and inside the DM I get an index number.

Thanks again,

Jim
Hi,

I am not completely sure about feasibility of accessing SharePoint objects in Data Macro.

However, if feasible -
Add reference to SharePoint assemblies (64 bit)

Using SharePoint Object model, you can get related user details -

using (SPSite site=new SPSite(siteurl))
{
using (SPWeb web=site.OpenWeb())
{
string userName= web.AllUsers.GetByID(Convert.ToInt32(userid)).Name;
}
}

I hope it helps.
Raj,

Thank you very much for trying but, I’m not a SharePoint web application developer.  In the event there is no way to actually retrieve the User Name or Logged In User Name through a DM your suggestion may help a developer here.

Thanks again,

Jim
ASKER CERTIFIED SOLUTION
Avatar of phonepagerfax
phonepagerfax

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Did not know that the meta data fields would be maintained by SP as records were updated by the Users.