Community
Showing results for 
Search instead for 
Do you mean 
Reply

How to get last synchronized data using SDK?

Champion Listener
Posts: 32
Country: Canada

How to get last synchronized data using SDK?

[ Edited ]

Hello,

 

I'm trying to find a way how to get data from the main ACT! database which is synced from the remote databases. I'm using Lookups.LastSyncLookup method from the SDK. But for some reason, I get "Object reference not set" exception while I'm trying to get ContactList. I was unable to find more details about this method in the SDK. Here is the code that i'm using:

 

IContactSource contactSource = null;
IGroupSource groupSource = null;
ICompanySource companySource = null;
System.Data.DataSet ds = new System.Data.DataSet();
SyncDB[] syncDBList = ActFramework.SynchronizationManager.GetAllRemoteSyncDBs();
SyncDB syncDB = null;


if (syncDBList != null)
{
for (int i = 0; i < syncDBList.Length; i++)
{
syncDB = syncDBList[i];
ActFramework.Lookups.LastSyncLookup(ds, out groupSource, out companySource, out contactSource, "Replace", "CONTACT", syncDB.SyncDBID, DateTime.MinValue, DateTime.MaxValue, false, true, true, true, ActFramework.Contacts.GetMyRecord().ID);
}
}
if (contactSource != null)
{
ContactFieldDescriptor cfdETime = ActFramework.Contacts.GetFieldDescriptor("TBL_CONTACT.EDITDATE", true) as ContactFieldDescriptor;
SortCriteria[] sc = {new SortCriteria( cfdETime , ListSortDirection.Descending )};
ContactList cList = contactSource.GetContacts(sc); //this is the line where "Object reference not set" is thrown

}

 

Can you please tell me what am i doing wrong? Can you provide me with a working sample of code?

Also, i need the data (Contacts, Activities and Notes/Histories) synced from the last session. This is available through UI. How can i achieve this through SDK, what parameters should i pass for "fromDate" and "toDate"?

contactSource.GetContacts(sortCriteria) will give me list of contacts only, right? How to get activities and notes/histories from the last syncing session?

 

Thanks a lot.

 

Katerina

 

 

Message Edited by katerina on 05-26-2008 06:43 AM
Champion Listener
Posts: 32
Country: Canada

Re: How to get last synchronized data using SDK?

[ Edited ]

OK, maybe I wasn't clear enough. I'm not looking for someone to debug my code.

 

What I need is some more information how to use method ActFramework.Lookups.LastSyncLookup. It has string parameters "lookupType" and "entity". There is nothing in documentation about this, what strings are allowed. For example, I spent 2 hours to find out that i should use "CONTACT", not "Contact" as "entity" parameter. Well, this is not well documented. I'm still not sure if i'm using the correct string for "lookupType" parameter.

 

Can someone provide me with some more details about LastSyncLookup or a working sample of code?

I'll really appreciate this.

Thanks.

 

Katerina

 

Message Edited by katerina on 05-27-2008 08:54 AM
Platinum Elite Contributor
Posts: 14,384
Country: Australia

Re: How to get last synchronized data using SDK?