Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

How do I find the companies and contact persons in the recycle bin?

SuperOffice version 8.3 R04

Hi all,

Is there a way to find the objects that are listed in the recycle bin using the service layer?

I use this query but it obviously not right becaus it does not return anything.

FindAgent find = new FindAgent();

FindResults results = find.FindFromRestrictionsColumns(new ArchiveRestrictionInfo[] { new ArchiveRestrictionInfo("contactDeleted", ">", "1760-01-01") }, FindContactProvider.ProviderName, new string[] { "number" }, 1000, 0);

I will return the result to another system so they can do something with the information on their side.

Best regards

Patrik

 

RE: How do I find the companies and contact persons in the recycle bin?

Hi Patrik,

Try ArchiveRestrictionInfo("contactDeleted", "set", "1").

Person doesn't have a personDelete field (unfortunately), only personDeletedDate. For that, one of the Date or DateTime operators.

Hope this helps!

Af: Tony Yates 6. sep 2018

RE: How do I find the companies and contact persons in the recycle bin?

Thanks Tony,

Thant did not help. No rows returned.

The code looks like this now (added code commented out that I tried with also).

 

ArchiveAgent aa = new ArchiveAgent();

ArchiveListItem[] contacts = aa.GetArchiveListByColumns(FindContactProvider.ProviderName, new string[] { "number" }, null,

new ArchiveRestrictionInfo[] { new ArchiveRestrictionInfo("contactDeleted", "set", "1") }, new string[] { "contact" }, 0, 1000);

foreach (ArchiveListItem item in contacts)

{

deletedCompanyList.Add(new DeletedCompany() { CustomerNo = item.ColumnData["number"].RawValue.ToString() });

}

//FindAgent find = new FindAgent();

//FindResults results = find.FindFromRestrictionsColumns(new ArchiveRestrictionInfo[] { new ArchiveRestrictionInfo("contactDeleted", "set", "1") }, FindContactProvider.ProviderName, new string[] { "number" }, 1000, 0);

//foreach (ArchiveListItem item in results.ArchiveRows)

//{

// deletedCompanyList.Add(new DeletedCompany() { CustomerNo = item.ColumnData["number"].RawValue.ToString() });

//}

To add to this issue.

I tried to list deleted companies in the webclient/find dialog using Deleted is Yes, no other criterias.
That did not return any rows either.
If I check in the recycle bin there are 9 rows, all companies.

Best regards
Patrik

 

Af: Patrik Lindholm 6. sep 2018

RE: How do I find the companies and contact persons in the recycle bin?

Hi Patrik,

Ok, alternatively, use the RecyclePerson and RecycleContact archive providers, and use getAllRows = true. 

Best regards.

Af: Tony Yates 6. sep 2018

RE: How do I find the companies and contact persons in the recycle bin?

Thanks,

 

That did the trick.

The commented out code does not work.

ArchiveAgent aa = new ArchiveAgent();

ArchiveListItem[] contacts = aa.GetArchiveListByColumns(RecycleContactsProvider.ProviderName, new string[] { "number" }, null,

new ArchiveRestrictionInfo[] { new ArchiveRestrictionInfo("getAllRows", "=", "true") }, new string[] { "contact", "forAllUsers" }, 0, 1000);

foreach (ArchiveListItem item in contacts)

{

deletedCompanyList.Add(new DeletedCompany() { CustomerNo = item.ColumnData["number"].RawValue.ToString() });

}

//FindAgent find = new FindAgent();

//FindResults results = find.FindFromRestrictionsColumns(new ArchiveRestrictionInfo[] { new ArchiveRestrictionInfo("getAllRows", "=", "true") }, RecycleContactsProvider.ProviderName, new string[] { "number" }, 1000, 0);

//foreach (ArchiveListItem item in results.ArchiveRows)

//{

// deletedCompanyList.Add(new DeletedCompany() { CustomerNo = item.ColumnData["number"].RawValue.ToString() });

//}

 

Doing moon walk right now :)

 

Best regards

 

Af: Patrik Lindholm 6. sep 2018

RE: How do I find the companies and contact persons in the recycle bin?

contact.deleted, I believe, is something we inherited from CS. Not used in SM.
The restriction you needed for Find to work is deletedDate, here copied from the Win find system:

active=True&name=deletedDate&operator=after&numvalues=1&value=[D:01/02/1970]

(Easiest thing is to try out the find system in SM first...)

 

I believe the strategy deep inside the contact/person providers is that the deletedDate restriction is added by default in order to skip deleted contact & persons unless the deletedDate restriction was explicitly added.

I.o.w. if you want to see deleted Contacts & Persons in the find system, add the deletedDate restriction with a date > 1.1.1970 (win).

/conrad

 

Af: Conrad Weyns 6. sep 2018