コード例 #1
0
ファイル: GDataDgc.cs プロジェクト: robertj/GDataCmdLet
            public GDataTypes.GDataContactEntrys AppendContactEntrys(ContactEntry contactEntry, GDataTypes.GDataContactEntrys gDataContactEntrys)
            {
                var _gDataContactEntry = new GDataTypes.GDataContactEntry();

                    _gDataContactEntry.Name = contactEntry.Title.Text;
                    foreach (var _emailEntry in contactEntry.Emails)
                    {
                        if (_emailEntry.Work == true)
                        {
                            _gDataContactEntry.Email = _emailEntry.Address;
                        }
                    }
                    foreach (var _phoneNumberEntry in contactEntry.Phonenumbers)
                    {
                        if (_phoneNumberEntry.Rel == ContactsRelationships.IsWork)
                        {
                            _gDataContactEntry.PhoneNumber = _phoneNumberEntry.Value;
                        }
                        if (_phoneNumberEntry.Rel == ContactsRelationships.IsHome)
                        {
                            _gDataContactEntry.HomePhoneNumber = _phoneNumberEntry.Value;
                        }
                        if (_phoneNumberEntry.Rel == ContactsRelationships.IsMobile)
                        {
                            _gDataContactEntry.MobilePhoneNumber = _phoneNumberEntry.Value;
                        }
                        if (_phoneNumberEntry.Rel == ContactsRelationships.IsOther)
                        {
                            _gDataContactEntry.OtherPhoneNumber = _phoneNumberEntry.Value;
                        }
                    }
                    foreach (var _postaAddressEntry in contactEntry.PostalAddresses)
                    {
                        if (_postaAddressEntry.Rel == ContactsRelationships.IsWork)
                        {
                            _gDataContactEntry.PostalAddress = _postaAddressEntry.FormattedAddress;
                        }
                        if (_postaAddressEntry.Rel == ContactsRelationships.IsHome)
                        {
                            _gDataContactEntry.HomeAddress = _postaAddressEntry.FormattedAddress;
                        }
                    }
                    _gDataContactEntry.SelfUri = contactEntry.SelfUri.ToString();
                    gDataContactEntrys.Add(_gDataContactEntry);

                return gDataContactEntrys;
            }
コード例 #2
0
ファイル: GDataDgc.cs プロジェクト: robertj/GDataCmdLet
            public GDataTypes.GDataUserAliasEntry AppendUserAliasEntry(string _Xml, GDataTypes.GDataUserAliasEntry userAliasEntry)
            {
                var _paresdXml = new GDataTypes.ParseXML(_Xml);
                var _userSingelAliasEntry = new GDataTypes.GDataAliasEntry();
                foreach (var _entry in _paresdXml.ListFormat)
                {
                    var _aliasEntry = new GDataTypes.GDataAliasEntry();
                    foreach (var _attribute in _entry.at)
                    {
                        if (_attribute.Value == "aliasEmail" || _attribute.Value == "userEmail")
                        {
                            if (_attribute.Value == "aliasEmail")
                            {
                                _userSingelAliasEntry.aliasEmail = _attribute.NextAttribute.Value;
                            }
                            if (_attribute.Value == "userEmail")
                            {
                                _userSingelAliasEntry.UserName = _attribute.NextAttribute.Value;
                            }
                            if (_userSingelAliasEntry.UserName != null && _userSingelAliasEntry.aliasEmail != null)
                            {
                                userAliasEntry.Add(_userSingelAliasEntry);
                            }
                        }
                    }
                    foreach (var _subEntry in _entry.sub)
                    {
                        foreach (var _attribute in _subEntry.at)
                        {

                            if (_attribute.Value == "aliasEmail" || _attribute.Value == "userEmail")
                            {
                                if (_attribute.Value == "aliasEmail")
                                {
                                    _aliasEntry.aliasEmail = _attribute.NextAttribute.Value;
                                }
                                if (_attribute.Value == "userEmail")
                                {
                                    _aliasEntry.UserName = _attribute.NextAttribute.Value;
                                }
                                if (_aliasEntry.UserName != null && _aliasEntry.aliasEmail != null)
                                {
                                    userAliasEntry.Add(_aliasEntry);
                                }
                            }
                        }
                    }
                }
                return userAliasEntry;
            }
コード例 #3
0
ファイル: GDataDgc.cs プロジェクト: robertj/GDataCmdLet
 public GDataTypes.GDataCalendarEntrys AppendCalendarEntrys(CalendarEntry calendarEntry, GDataTypes.GDataCalendarEntrys gDataCalendarEntrys)
 {
     var _gDataCalendarEntry = new GDataTypes.GDataCalendarEntry();
     if (calendarEntry.Title.Text != null)
     {
         _gDataCalendarEntry.Name = calendarEntry.Title.Text;
     }
     if (calendarEntry.Color != null)
     {
         _gDataCalendarEntry.Color = calendarEntry.Color;
     }
     if (calendarEntry.Summary != null)
     {
         _gDataCalendarEntry.Description = calendarEntry.Summary.Text;
     }
     if (calendarEntry.Location != null)
     {
         _gDataCalendarEntry.Location = calendarEntry.Location.ValueString;
     }
     _gDataCalendarEntry.Hidden = calendarEntry.Hidden;
     _gDataCalendarEntry.Selected = calendarEntry.Selected;
     if (calendarEntry.TimeZone != null)
     {
         _gDataCalendarEntry.TimeZone = calendarEntry.TimeZone;
     }
     if (calendarEntry.AccessLevel != null)
     {
         _gDataCalendarEntry.AccessLevel = calendarEntry.AccessLevel;
     }
     if (calendarEntry.SelfUri.ToString() != null)
     {
         _gDataCalendarEntry.SelfUri = calendarEntry.SelfUri.ToString();
     }
     gDataCalendarEntrys.Add(_gDataCalendarEntry);
     return gDataCalendarEntrys;
 }
コード例 #4
0
ファイル: GDataDgc.cs プロジェクト: robertj/GDataCmdLet
            public GDataTypes.GDataProfileEntrys AppendProfileEntrys(string xml, GDataTypes.GDataProfileService profileService, GDataTypes.GDataProfileEntrys profileEntrys)
            {
                var _paresdXml = new GDataTypes.ParseXML(xml);
                string _profileLink = "http://www.google.com/m8/feeds/profiles/domain/" + profileService.Domain + "/full/";

                foreach (var _sEntry in _paresdXml.ListFormat)
                {
                    if (_sEntry.name == "{http://www.w3.org/2005/Atom}entry")
                    {
                        var _profileEntry = new GDataTypes.GDataProfileEntry();
                        _profileEntry.Domain = profileService.Domain;
                        foreach (var _entry in _sEntry.sub)
                        {
                            if (_entry.name == "{http://www.w3.org/2005/Atom}id")
                            {
                                _profileEntry.UserName = _entry.value.Replace(_profileLink, "");
                            }
                            if (_entry.name == "{http://schemas.google.com/g/2005}structuredPostalAddress")
                            {
                                foreach (var _attribute in _entry.at)
                                {
                                    if (_attribute.Value == "http://schemas.google.com/g/2005#home")
                                    {
                                        _profileEntry.HomePostalAddress = _entry.value;
                                    }
                                    if (_attribute.Value == "http://schemas.google.com/g/2005#work")
                                    {
                                        _profileEntry.PostalAddress = _entry.value;
                                    }
                                }
                            }
                            if (_entry.name == "{http://schemas.google.com/g/2005}phoneNumber")
                            {
                                foreach (var _attribute in _entry.at)
                                {
                                    if (_attribute.Value == "http://schemas.google.com/g/2005#other")
                                    {
                                        _profileEntry.OtherPhoneNumber = _entry.value;
                                    }
                                    if (_attribute.Value == "http://schemas.google.com/g/2005#work")
                                    {
                                        _profileEntry.PhoneNumber = _entry.value;
                                    }
                                    if (_attribute.Value == "http://schemas.google.com/g/2005#mobile")
                                    {
                                        _profileEntry.MobilePhoneNumber = _entry.value;
                                    }
                                    if (_attribute.Value == "http://schemas.google.com/g/2005#home")
                                    {
                                        _profileEntry.HomePhoneNumber = _entry.value;
                                    }
                                }
                            }
                        }
                        profileEntrys.Add(_profileEntry);
                    }
                }

                return profileEntrys;
            }