PHP - Create contact inside System Group: myContacts - google-contacts-api

I've a little question.
I want to create / update a contacts inside a system group,precisely myContacts group but unfortunately I can not.
This is my code:
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005">
<atom:category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/contact/2008#contact"/>
<gd:name>
<gd:givenName>Surname</gd:givenName>
<gd:familyName>Name</gd:familyName>
<gd:fullName>Name Surname</gd:fullName>
</gd:name>
<gd:email rel="http://schemas.google.com/g/2005#work" primary="true" address="firstemail#gmail.com" />
<gd:phoneNumber rel="http://schemas.google.com/g/2005#home">1234567891</gd:phoneNumber>
<gContact:groupMembershipInfo deleted="false" href="http://www.google.com/m8/feeds/groups/email#gmail.com/base/myContacts"/>
How I can create contact inside that system Group?

Related

Google Contacts API PUT Invalid XML Document

I am trying to update contact info (Nickname) through Google Contact API, but getting an Invalid XML Document error (400 Bad Request). The request that I am sending is documentation : https://developers.google.com/contacts/v3/#updating_contacts.
this is my request body:
<entry gd:etag="&quot;Qno-eTVSLit7I2A9XBJUF0kKRAY.&quot;">
<id>http://www.google.com/m8/feeds/contacts/cdatatester%40gmail.com/base/21aa268e8c9eea4c</id>
<updated>2019-01-17T15:52:03.451Z</updated>
<app:edited>2019-01-17T15:52:03.451Z</app:edited>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/contact/2008#contact"></category>
<title>Elizabeth Bennet</title>
<content>Notes</content>
<link rel="http://schemas.google.com/contacts/2008/rel#photo" type="image/*" href="https://www.google.com/m8/feeds/photos/media/cdatatester%40gmail.com/21aa268e8c9eea4c"></link>
<link rel="self" type="application/atom+xml" href="https://www.google.com/m8/feeds/contacts/cdatatester%40gmail.com/full/21aa268e8c9eea4c"></link>
<link rel="edit" type="application/atom+xml" href="https://www.google.com/m8/feeds/contacts/cdatatester%40gmail.com/full/21aa268e8c9eea4c"></link>
<gd:name>
<gd:fullName>Elizabeth Bennet</gd:fullName>
<gd:givenName>Altin2</gd:givenName>
<gd:familyName>Bennet</gd:familyName>
</gd:name>
<gContact:nickname>Altin</gContact:nickname>
<gd:email rel="http://schemas.google.com/g/2005#home" address="liz#gmail.com"></gd:email>
<gd:email rel="http://schemas.google.com/g/2005#work" address="liz#example.org"></gd:email>
<gd:phoneNumber rel="http://schemas.google.com/g/2005#work" uri="tel:+1-206-555-1212">(206)555-1212</gd:phoneNumber>
<gd:phoneNumber rel="http://schemas.google.com/g/2005#home" uri="tel:+1-206-555-1213">(206)555-1213</gd:phoneNumber>
<gd:structuredPostalAddress rel="http://schemas.google.com/g/2005#home">
<gd:formattedAddress>1600 Amphitheatre Pkwy
Mountain View
CA</gd:formattedAddress>
<gd:street>1600 Amphitheatre Pkwy</gd:street>
<gd:city>Mountain View</gd:city>
<gd:country code="CA">CA</gd:country>
</gd:structuredPostalAddress>
<gContact:userDefinedField key="Color" value="Green"></gContact:userDefinedField>
<gContact:userDefinedField key="Size" value="Medium"></gContact:userDefinedField>
<gContact:groupMembershipInfo deleted="false" href="http://www.google.com/m8/feeds/groups/cdatatester%40gmail.com/base/6"></gContact:groupMembershipInfo>
<gContact:groupMembershipInfo deleted="false" href="http://www.google.com/m8/feeds/groups/cdatatester%40gmail.com/base/782732538ae3faa4"></gContact:groupMembershipInfo>
</entry>
Is there anything wrong with my request? I cannot spot any error.

How to do deep traversals with FindItem queries

I am sending the following XML query to EWS using the Office.context.mailbox.makeEwsRequestAsync method. It works as long as Traversal is set to "Shallow". I get a "The request is invalid" error when I set Traversal to "Deep".
How do I recursively search subfolders if I can't do deep searches?
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013_SP1" />
</soap:Header>
<soap:Body>
<m:FindItem Traversal="Shallow">
<m:ItemShape>
<t:BaseShape>AllProperties</t:BaseShape>
</m:ItemShape>
<m:IndexedPageItemView MaxEntriesReturned="10" Offset="0" BasePoint="Beginning" />
<m:Restriction>
<t:Contains ContainmentMode="FullString" ContainmentComparison="IgnoreCase">
<t:FieldURI FieldURI="item:Categories" />
<t:Constant Value="MyCategory" />
</t:Contains>
</m:Restriction>
<m:ParentFolderIds>
<t:DistinguishedFolderId Id="inbox" />
<t:DistinguishedFolderId Id="sentitems" />
</m:ParentFolderIds>
</m:FindItem>
</soap:Body>
</soap:Envelope>
The FindItem EWS call does not support Traversal="Deep". See FindItem.
This is because the call will search for items in the folders specified in ParentFolderIds. In order to do a recursive search, you will need to get the list of folders to include in the search by using the FindFolder EWS Operation which supports Traversal="Deep" on non public folders. See FindFolder for additional documentation.

EWS operation to edit Distribution list

I am looking for an EWS operation to edit a Distribution list. Here edit means, adding\deleting a existing contact into\from an existing group or changing Display Name of Group.
I have tried option like mentioned in following link:- https://social.msdn.microsoft.com/Forums/office/en-US/db110c4e-a0f2-40de-9276-3e30458b254f/ews-maximum-number-of-members-in-a-contact-group?forum=exchangesvrdevelopment
Also used properties like AppendToItemField, SetItemField and DeleteItemField?But error comes as "The method or operation is not implemented"
Finally i got the answer for Editing Groups. here is SOAP call which worked for me:-
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<RequestServerVersion Version="Exchange2013" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
</soap:Header>
<soap:Body>
<UpdateItem ConflictResolution="AutoResolve" MessageDisposition="SaveOnly" SendMeetingInvitationsOrCancellations="SendToNone" xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<ItemChanges>
<t:ItemChange>
<t:ItemId Id="AAMkADZmMjJlMDk...." ChangeKey="EgAAAB..." />
<t:Updates>
<t:AppendToItemField>
<t:FieldURI FieldURI="distributionlist:Members" />
<t:DistributionList>
<t:Members>
<t:Member>
<t:Mailbox>
<t:ItemId Id="AAMkADZmMjJ..." ChangeKey="EQAAABYA..." />
</t:Mailbox>
</t:Member>
<t:Member>
<t:Mailbox>
<t:EmailAddress>user#contonso.com</t:EmailAddress>
</t:Mailbox>
</t:Member>
</t:Members>
</t:DistributionList>
</t:AppendToItemField>
</t:Updates>
</t:ItemChange>
</ItemChanges>
</UpdateItem>
</soap:Body>
</soap:Envelope>

ExchangeEWS throws ErrorCalendarOccurrenceIndexIsOutOfRecurrenceRange when I'm trying to get an existing occurence by index

I have the strange situation:
I created recurring calendar event by Exchange web service using the request like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types">
<soapenv:Header>
<typ:RequestServerVersion Version="Exchange2007_SP1"/>
<typ:ExchangeImpersonation>
<typ:ConnectingSID>
<typ:PrimarySmtpAddress>someuser#clab.local</typ:PrimarySmtpAddress>
</typ:ConnectingSID>
</typ:ExchangeImpersonation>
</soapenv:Header>
<soapenv:Body>
<mes:CreateItem MessageDisposition="SaveOnly" SendMeetingInvitations="SendToAllAndSaveCopy">
<mes:Items>
<typ:CalendarItem>
<typ:Subject>QC42135 test 3</typ:Subject>
<typ:Body BodyType="HTML"/>
<typ:Importance>Normal</typ:Importance>
<typ:ReminderIsSet>false</typ:ReminderIsSet>
<typ:Start>2014-07-25T04:00:00-05:00</typ:Start>
<typ:End>2014-07-25T05:00:00-05:00</typ:End>
<typ:Location/>
<typ:IsResponseRequested>false</typ:IsResponseRequested>
<typ:RequiredAttendees>
<typ:Attendee>
<typ:Mailbox>
<typ:EmailAddress>user1#clab.local</typ:EmailAddress>
</typ:Mailbox>
</typ:Attendee>
</typ:RequiredAttendees>
<typ:Recurrence>
<typ:WeeklyRecurrence>
<typ:Interval>2</typ:Interval>
<typ:DaysOfWeek>Wednesday Thursday Friday Saturday Sunday</typ:DaysOfWeek>
</typ:WeeklyRecurrence>
<typ:EndDateRecurrence>
<typ:StartDate>2014-07-20</typ:StartDate>
<typ:EndDate>2014-07-30</typ:EndDate>
</typ:EndDateRecurrence>
</typ:Recurrence>
<typ:MeetingTimeZone TimeZoneName="FLE Standard Time"/>
</typ:CalendarItem>
</mes:Items>
</mes:CreateItem>
</soapenv:Body>
</soapenv:Envelope>
Series of occurences were successfully created:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<t:ServerVersionInfo MajorVersion="8" MinorVersion="3" MajorBuildNumber="348" MinorBuildNumber="2" Version="Exchange2007_SP1" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"/>
</soap:Header>
<soap:Body>
<m:CreateItemResponse xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
<m:ResponseMessages>
<m:CreateItemResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Items>
<t:CalendarItem>
<t:ItemId Id="AAMkADVmYWI5YjhjLTdiN2MtNDJjNi04ZWIzLTUzNjVjZjk1MWY5OQBGAAAAAACuKk855hnzQ7gDOBltDFd1BwAa27cU8ukoS5yPRueWn38YAAobNHU+AAAa27cU8ukoS5yPRueWn38YAHDq5rCGAAA=" ChangeKey="DwAAABYAAAAa27cU8ukoS5yPRueWn38YAHDq52bj"/>
</t:CalendarItem>
</m:Items>
</m:CreateItemResponseMessage>
</m:ResponseMessages>
</m:CreateItemResponse>
</soap:Body>
</soap:Envelope>
But when I'm trying to get occurrences of the event
by index right after creation I'm able to get only first occurrence. For the others I receive ErrorCalendarOccurrenceIndexIsOutOfRecurrenceRange.
Here is GetItem request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
<soapenv:Header><typ:RequestServerVersion Version="Exchange2007_SP1"/>
<typ:ExchangeImpersonation>
<typ:ConnectingSID>
<typ:PrimarySmtpAddress>someuser#clab.local</typ:PrimarySmtpAddress>
</typ:ConnectingSID>
</typ:ExchangeImpersonation>
</soapenv:Header>
<soapenv:Body>
<mes:GetItem>
<mes:ItemShape>
<typ:BaseShape>IdOnly</typ:BaseShape>
</mes:ItemShape>
<mes:ItemIds>
<typ:OccurrenceItemId RecurringMasterId="AAMkADVmYWI5YjhjLTdiN2MtNDJjNi04ZWIzLTUzNjVjZjk1MWY5OQBGAAAAAACuKk855hnzQ7gDOBltDFd1BwAa27cU8ukoS5yPRueWn38YAAobNHU+AAAa27cU8ukoS5yPRueWn38YAHDq5rCGAAA=" ChangeKey="DwAAABYAAAAa27cU8ukoS5yPRueWn38YAHDq52bj" InstanceIndex="1" />
<typ:OccurrenceItemId RecurringMasterId="AAMkADVmYWI5YjhjLTdiN2MtNDJjNi04ZWIzLTUzNjVjZjk1MWY5OQBGAAAAAACuKk855hnzQ7gDOBltDFd1BwAa27cU8ukoS5yPRueWn38YAAobNHU+AAAa27cU8ukoS5yPRueWn38YAHDq5rCGAAA=" ChangeKey="DwAAABYAAAAa27cU8ukoS5yPRueWn38YAHDq52bj" InstanceIndex="2" />
<typ:OccurrenceItemId RecurringMasterId="AAMkADVmYWI5YjhjLTdiN2MtNDJjNi04ZWIzLTUzNjVjZjk1MWY5OQBGAAAAAACuKk855hnzQ7gDOBltDFd1BwAa27cU8ukoS5yPRueWn38YAAobNHU+AAAa27cU8ukoS5yPRueWn38YAHDq5rCGAAA=" ChangeKey="DwAAABYAAAAa27cU8ukoS5yPRueWn38YAHDq52bj" InstanceIndex="3" />
<typ:OccurrenceItemId RecurringMasterId="AAMkADVmYWI5YjhjLTdiN2MtNDJjNi04ZWIzLTUzNjVjZjk1MWY5OQBGAAAAAACuKk855hnzQ7gDOBltDFd1BwAa27cU8ukoS5yPRueWn38YAAobNHU+AAAa27cU8ukoS5yPRueWn38YAHDq5rCGAAA=" ChangeKey="DwAAABYAAAAa27cU8ukoS5yPRueWn38YAHDq52bj" InstanceIndex="4" />
<typ:OccurrenceItemId RecurringMasterId="AAMkADVmYWI5YjhjLTdiN2MtNDJjNi04ZWIzLTUzNjVjZjk1MWY5OQBGAAAAAACuKk855hnzQ7gDOBltDFd1BwAa27cU8ukoS5yPRueWn38YAAobNHU+AAAa27cU8ukoS5yPRueWn38YAHDq5rCGAAA=" ChangeKey="DwAAABYAAAAa27cU8ukoS5yPRueWn38YAHDq52bj" InstanceIndex="5" />
</mes:ItemIds>
</mes:GetItem>
</soapenv:Body>
</soapenv:Envelope>
And response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<t:ServerVersionInfo MajorVersion="8" MinorVersion="3" MajorBuildNumber="348" MinorBuildNumber="2" Version="Exchange2007_SP1" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"/>
</soap:Header>
<soap:Body>
<m:GetItemResponse xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
<m:ResponseMessages>
<m:GetItemResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Items>
<t:CalendarItem>
<t:ItemId Id="AAMkADVmYWI5YjhjLTdiN2MtNDJjNi04ZWIzLTUzNjVjZjk1MWY5OQFRAAiI0XGjJ/YgAEYAAAAAripPOeYZ80O4AzgZbQxXdQcAGtu3FPLpKEucj0bnlp9/GAAKGzR1PgAAGtu3FPLpKEucj0bnlp9/GABw6uawhgAAEA==" ChangeKey="DwAAABYAAAAa27cU8ukoS5yPRueWn38YAHDq52bj"/>
</t:CalendarItem>
</m:Items>
</m:GetItemResponseMessage>
<m:GetItemResponseMessage ResponseClass="Error">
<m:MessageText>Occurrence index is out of recurrence range.</m:MessageText>
<m:ResponseCode>ErrorCalendarOccurrenceIndexIsOutOfRecurrenceRange</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Items/>
</m:GetItemResponseMessage>
<m:GetItemResponseMessage ResponseClass="Error">
<m:MessageText>Occurrence index is out of recurrence range.</m:MessageText>
<m:ResponseCode>ErrorCalendarOccurrenceIndexIsOutOfRecurrenceRange</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Items/>
</m:GetItemResponseMessage>
<m:GetItemResponseMessage ResponseClass="Error">
<m:MessageText>Occurrence index is out of recurrence range.</m:MessageText>
<m:ResponseCode>ErrorCalendarOccurrenceIndexIsOutOfRecurrenceRange</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Items/>
</m:GetItemResponseMessage>
<m:GetItemResponseMessage ResponseClass="Error">
<m:MessageText>Occurrence index is out of recurrence range.</m:MessageText>
<m:ResponseCode>ErrorCalendarOccurrenceIndexIsOutOfRecurrenceRange</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Items/>
</m:GetItemResponseMessage>
</m:ResponseMessages>
</m:GetItemResponse>
</soap:Body>
</soap:Envelope>
I found the description of recurring event on Microsoft site http://msdn.microsoft.com/en-us/library/office/dd633684%28v=exchg.80%29.aspx
and according the documentation when a recurring series is created, each occurrence item has as index that represents its position in the series.
The index starts at one and advances by one for each item in the series. But it seems to be incorrect.
In my case obviously occurrences are indexed in different way.
Can anyone explain how Exchange indexes occurrences? How can I get certain occurrence in the series?

Update app.config from WIX setup?

I am trying Wix 3.6 and this is how it looks right now :
<?xml version="1.0" encoding="UTF-8"?>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="myappINSTALLDIR" Name="myapp5Service">
<Component Id="SampleServiceComponent" DiskId="1" Guid="6f51c0f3-776c-4aec-a200-1f199352c6c3" Win64="yes">
<File Id="myapp5.WindowsService.exe" Name="myapp5.WindowsService.exe" Source="$(var.myapp.WindowsService.TargetDir)\myapp5.WindowsService.exe" KeyPath='yes'/>
...
<ServiceInstall Id="InstallmyappService" DisplayName="myappService" Name="myapp5.WindowsService.exe" Description="myapp 5 Service - För effektivare och enklare operationsplanering" Account="LocalSystem" ErrorControl="normal" Start="auto" Type="ownProcess" Vital="yes" />
<ServiceControl Id="ControlmyappService" Name="myapp5.WindowsService.exe" Start="install" Stop="both" Remove="uninstall" Wait="yes" />
</Component>
</Directory>
</Directory>
<WixVariable Id="WixUIBannerBmp" Value="$(var.ProjectDir)\Image\myappTopBanner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="$(var.ProjectDir)\Image\myappDialogBackground.bmp" />
<Property Id="WIXUI_INSTALLDIR" Value="myappINSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />
<Feature Id="ProductFeature" Title="Wix_myapp.WindowsService" Level="1">
<ComponentRef Id="SampleServiceComponent" />
</Feature>
<Media Id="1" Cabinet="SampleServiceComponent.cab" EmbedCab="yes" />
</Product>
Now I need to add a dialog to the Wix setup where one appSetting and one baseadress(WCF) is set to the app.config. This most be done before the installation becouse it will decide the name of the Windows Service that the Wix is installning.
And exampel would be great!
Edit 1:
<WixVariable Id="WixUIBannerBmp" Value="$(var.ProjectDir)\Image\myappTopBanner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="$(var.ProjectDir)\Image\myappDialogBackground.bmp" />
<Property Id="SERVICEADDRESS" Value="http://serviceaddress"/>
<Property Id="WIXUI_INSTALLDIR" Value="myappINSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />
<util:XmlFile Id="UpdateBaseAddress"
Action="setValue"
File="$(var.myapp.WindowsService.TargetDir)\myapp5.WindowsService.exe.config"
SelectionLanguage="XPath"
Permanent="yes"
ElementPath="/configuration/applicationSettings/ServiceName"
Name="baseAddress" Value="[SERVICEADDRESS]" />
<Feature Id="ProductFeature" Title="Wix_myapp.WindowsService" Level="1">
<ComponentRef Id="SampleServiceComponent" />
</Feature>
<Media Id="1" Cabinet="SampleServiceComponent.cab" EmbedCab="yes" />
</Product>
You could add in a reference to the WixUtilExtension.dll to the installer project, then use XmlFile to update the app.config like:
<Property Id="SERVICEADDRESS" Value="http://serviceaddress"/>
<util:XmlFile Id="UpdateBaseAddress"
Action="setValue"
File="[DirApplication]$(var.app.config)"
SelectionLanguage="XPath"
Permanent="yes"
ElementPath="/configuration/applicationSettings/...."
Name="baseAddress" Value="[SERVICEADDRESS]" />
Note that you'll need to set the directory and the name of the .config file (you could just use $(var.ProjectName.TargetFileName).config which should work it out for you automatically