Girdhar Patel585805

HI,

can any help me on how can i edit the contacts available on device

before editing i have ItemId of all the conatcts available with me. now using that ItemId i have to retrive the conatct details and have to edit the same.

plz give me some idea how i have to proceed

if any one is having a sample code then plz forward it to girdhar.patel@hotmail.com

thanks in advance.



Re: Smart Devices General How to edit Contact on device?

Peter Ritchie

What kind of device WinCE, disk, hard drive, USB key, USB memory stick, etc.




Re: Smart Devices General How to edit Contact on device?

Girdhar Patel

HI ,

i want to edit the contact(s) available on device using c# API.

i have the ItemId of all the contacts availabel on device. now can any one tell me how can i retrive the contact details using ItemId and also how can i edit the contact

i want to iterate through contact collection and want to edit multiple contacts.

if any one is having a sample code for this then plz forward it to girdhar.patel@gmail.com

plz help me.

thanks in advance.





Re: Smart Devices General How to edit Contact on device?

Girdhar Patel

HI Peter,

thanks for ur reply first.

i am developing an application fro WinCE device





Re: Smart Devices General How to edit Contact on device?

Girdhar Patel

HI Peter,

i am tell u brifelly what i am trying to do.

i am using Microsoft.WindowsMobile.PocketOutlook.

i have a array of ItemId of some for exam. 10 contacts. now i have taken a ContactCollectionEnumarator and iterating through the conatcs. i will compare the ItemId of each contact with ItemId available in my array. if it matches, i have to edit the contact infomating. but when i am trying to edit the contact its throwing exception like cant modify the item in foreach statement.

so can u tell me how can i avoid this error.





Re: Smart Devices General How to edit Contact on device?

AlexFeinman

See Samples\CS\PocketOutlookSample in WM5 PPC SDK




Re: Smart Devices General How to edit Contact on device?

Zero Dai - MSFT

Hi Patel,

Yes, foreach statement is a read-only one, that you cannot modify the item that is being enumeratored.

And also, you don't need to compare the ItemId of each contact with ItemId available in you array. See the sample below:

Code Snippet

List<ItemId> list = new List<ItemId>();// suppose this is the ItemId array
OutlookSession session = new OutlookSession();
ContactCollection collection = session.Contacts.Items;
Contact contact;
for (int i = 0; i <= list.Count; i++)
{

// Initializes a new instance of the Contact Class,

// that references the item ID of an existing Contact.
contact = new Contact(list[i]);
// do the modification here
}

Regards,

Zero Dai - MSFT






Re: Smart Devices General How to edit Contact on device?

Girdhar Patel

thank you very much,

it worked fine for me.