Hi everyone
As you know, from Windows Vista, user contacts are not stored in .wab files anymore...
However, they are stored here:
X:\Users\Your User Name\Contacts
I want to CREATE / GENERATE contacts programatically and save them here in the same format.
This format is very simple and is user readable.
For example, this sample:
So, when I want to generate and save a contact here, I simply just change the email address and re-generate random IDs and save it as a .contact file in this location:
However, although the final file contents will be exactly in the same format, but Windows will not recognize my created files as contacts!!!
This is strange, I am sure they are in the same format!!!
Anyone knows why this happens?!
Thank you...
As you know, from Windows Vista, user contacts are not stored in .wab files anymore...
However, they are stored here:
X:\Users\Your User Name\Contacts
I want to CREATE / GENERATE contacts programatically and save them here in the same format.
This format is very simple and is user readable.
For example, this sample:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<c:contact c:Version="1" xmlns:c="http://schemas.microsoft.com/Contact" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:MSP2P="http://schemas.microsoft.com/Contact/Extended/MSP2P">
<c:CreationDate>2009-01-19T20:16:08Z</c:CreationDate><c:Extended xsi:nil="true"/>
<c:ContactIDCollection><c:ContactID c:ElementID="7a122ea4-c7c5-4eb3-855e-39c97dc46a54"><c:Value>a18452d7-bc26-467d-8a5c-527d2c70ba8b</c:Value></c:ContactID></c:ContactIDCollection><c:EmailAddressCollection><c:EmailAddress c:ElementID="0e59a008-481c-4c99-b3cc-c85c89d616ff"><c:Type>SMTP</c:Type><c:Address>user@domain.com</c:Address><c:LabelCollection><c:Label>Preferred</c:Label></c:LabelCollection></c:EmailAddress><c:EmailAddress c:ElementID="280c131c-a5ad-41ca-acc2-aff9030c76a2" xsi:nil="true"/></c:EmailAddressCollection><c:NameCollection><c:Name c:ElementID="e8afd09a-9406-4e42-bad1-b4148ade040e"><c:FormattedName>user@domain.com</c:FormattedName></c:Name></c:NameCollection><c:PhotoCollection><c:Photo c:ElementID="834fd30a-de94-4558-b650-d3d8c3e1fcd9"><c:LabelCollection><c:Label>UserTile</c:Label></c:LabelCollection></c:Photo></c:PhotoCollection></c:contact>
Visual Basic:
Dim OutputString As String = Nothing
OutputString = "<?xml version=""1.0"" encoding=""UTF-8""?>" + vbNewLine
OutputString = OutputString + "<c:contact c:Version=""1"" xmlns:c=""http://schemas.microsoft.com/Contact"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:MSP2P=""http://schemas.microsoft.com/Contact/Extended/MSP2P"">" + vbNewLine
OutputString = OutputString + vbTab + "<c:CreationDate>" + Now.ToString("yyyy-MM-dd") + "T" + Now.ToString("HH:mm:ss") + "Z</c:CreationDate><c:Extended xsi:nil=""true""/>" + vbNewLine
OutputString = OutputString + vbTab + "<c:ContactIDCollection><c:ContactID c:ElementID=""" + GenerateContactID() + """><c:Value>" + GenerateContactID() + "</c:Value></c:ContactID></c:ContactIDCollection><c:EmailAddressCollection><c:EmailAddress c:ElementID=""" + GenerateContactID() + """><c:Type>SMTP</c:Type><c:Address>" + MyReaders("Email").ToString + "</c:Address><c:LabelCollection><c:Label>Preferred</c:Label></c:LabelCollection></c:EmailAddress><c:EmailAddress c:ElementID=""" + GenerateContactID() + """ xsi:nil=""true""/></c:EmailAddressCollection><c:NameCollection><c:Name c:ElementID=""" + GenerateContactID() + """><c:FormattedName>" + MyReaders("Email").ToString + "</c:FormattedName></c:Name></c:NameCollection><c:PhotoCollection><c:Photo c:ElementID=""" + GenerateContactID() + """><c:LabelCollection><c:Label>UserTile</c:Label></c:LabelCollection></c:Photo></c:PhotoCollection></c:contact>" + vbNewLine
My.Computer.FileSystem.WriteAllText(WABPath + "\" + MyReaders("Email").ToString + ".contact", OutputString, False)
This is strange, I am sure they are in the same format!!!
Anyone knows why this happens?!
Thank you...