예제 #1
0
        public void Exporter_VContact()
        {
            var contact = new VContact
            {
                Name = "Keith Williams",
                FormattedName = "Williams, Keith",
                Birthday = new DateTime(1981, 4, 23),
                Title = "Captain",
                Organization = "4verse",
                Note = "Lorem ipsum dolor sit amet."
            };

            contact.Addresses.Add(new VAddress
            {
                StreetAddress = "28 St. Paul's Terrace",
                Locality = "York",
                Region = "North Yorkshire",
                PostalCode = "YO24 4BL",
                Country = "UNITED KINGDOM"
            });

            contact.TelephoneNumbers.Add(new VTelephone
            {
                TelephoneType = TelephoneType.CELL,
                Value = "07941521644",
                CountryCode = 44
            });

            contact.TelephoneNumbers.Add(new VTelephone
            {
                TelephoneType = TelephoneType.HOME,
                Value = "658796",
                AreaCode = "01904",
                CountryCode = 44
            });

            contact.EmailAddresses.Add(new VEmail
            {
                EmailType = EmailType.INTERNET,
                Value = "*****@*****.**"
            });

            contact.EmailAddresses.Add(new VEmail
            {
                EmailType = EmailType.INTERNET,
                Value = "*****@*****.**"
            });

            var exporter = new Exporter(contact);
            //var result = exporter.Export();

            var path = Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".vcf");
            exporter.SaveAs(path);
        }
예제 #2
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();
        }
예제 #3
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);
        }