Example #1
0
        public void ExportToDisk()
        {
            var vcard = new VContact();
            vcard.Name = "Keith Williams";
            vcard.Name.Title = "Mr.";
            vcard.Name.Suffix = "BA (Hons)";
            vcard.Name.MiddleName = "Arthur Elliot";
            vcard.FormattedName = "Williams, Keith";

            vcard.Organization = "Eurosafe UK";
            vcard.Title = "IT Manager";
            vcard.Role = "Manager";
            vcard.Note = "Some notes on Keith";

            vcard.UniqueIdentifier = Guid.NewGuid();
            vcard.Birthday = new DateTime(1981, 4, 23);

            var address = new VAddress
            {
                AddressType = AddressType.DOM,
                StreetAddress = "28 St. Paul's Terrace, Holgate",
                Locality = "York",
                Region = "North Yorkshire",
                PostalCode = "YO24 4BL",
                Country = "United Kingdom"
            };

            var tel = new VTelephone
            {
                CountryCode = 44,
                AreaCode = "01904",
                Value = "658 796",
                TelephoneType = TelephoneType.HOME
            };

            vcard.Addresses.Add(address);
            vcard.TelephoneNumbers.Add(tel);

            var exporter = new Versit.Core.Exporter(vcard);
            var result = exporter.Export();

            var file = new FileInfo(Path.Combine(Path.GetTempPath(), vcard.UniqueIdentifier.ToString() + ".vcf"));
            StreamWriter sw = file.CreateText();
            sw.Write(result);
            sw.Close();
        }
Example #2
0
        public void ExportVCard()
        {
            var vcard = new VContact();
            vcard.Name = "Keith Williams";
            vcard.Organization = "Eurosafe UK";
            vcard.Title = "IT Manager";
            vcard.FormattedName = "Mr. Keith Williams";

            var exporter = new Versit.Core.Exporter(vcard);
            var result = exporter.Export();

            Assert.IsNotNull(result);
        }