Created Google G-Suite shared contact missing name and title - google-admin-sdk

I have written a script to create a shared contact in my G-Suite domain. I have done the OAuth work, and am able to create a contact.
However, when I have created the contact, it does not have all the data I submitted. For example, it does not have name data or title information.
I have tried using the example Google has here: https://developers.google.com/admin-sdk/domain-shared-contacts/#Creating
This is exactly what I am posting:
<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>Elizabeth</gd:givenName>
<gd:familyName>Bennet</gd:familyName>
<gd:fullName>Elizabeth Bennet</gd:fullName>
</gd:name>
<atom:content type='text'>Notes</atom:content>
<gd:email rel='http://schemas.google.com/g/2005#work' primary='true' address='liz#gmail.com' displayName='E. Bennet' />
<gd:email rel='http://schemas.google.com/g/2005#home' address='liz#example.org' />
<gd:phoneNumber rel='http://schemas.google.com/g/2005#work' primary='true'>(206)555-1212</gd:phoneNumber>
<gd:phoneNumber rel='http://schemas.google.com/g/2005#home'>(206)555-1213</gd:phoneNumber>
<gd:im address='liz#gmail.com' protocol='http://schemas.google.com/g/2005#GOOGLE_TALK' primary='true' rel='http://schemas.google.com/g/2005#home' />
<gd:structuredPostalAddress rel='http://schemas.google.com/g/2005#work' primary='true'>
<gd:city>Mountain View</gd:city>
<gd:street>1600 Amphitheatre Pkwy</gd:street>
<gd:region>CA</gd:region>
<gd:postcode>94043</gd:postcode>
<gd:country>United States</gd:country>
<gd:formattedAddress>1600 Amphitheatre Pkwy Mountain View</gd:formattedAddress>
</gd:structuredPostalAddress>
</atom:entry>
It creates the contact, but is missing the names, title, etc.
This is what is returned by the post:
<?xml version='1.0' encoding='UTF-8' ?>
<entry xmlns='http://www.w3.org/2005/Atom' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:gd='http://schemas.google.com/g/2005' xmlns:gContact='http://schemas.google.com/contact/2008'>
<id>http://www.google.com/m8/feeds/contacts/compcc.com/base/36b40df989628b57</id>
<updated>2017-01-17T15:42:32.736Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/contact/2008#contact' />
<title type='text'></title>
<content type='text'>Notes</content>
<link rel='http://schemas.google.com/contacts/2008/rel#edit-photo' type='image/*' href='https://www.google.com/m8/feeds/photos/media/compcc.com/36b40df989628b57/1B2M2Y8AsgTpgAmY7PhCfg' />
<link rel='self' type='application/atom+xml' href='https://www.google.com/m8/feeds/contacts/compcc.com/full/36b40df989628b57' />
<link rel='edit' type='application/atom+xml' href='https://www.google.com/m8/feeds/contacts/compcc.com/full/36b40df989628b57/1484667752736001' />
<gd:email rel='http://schemas.google.com/g/2005#work' address='liz#gmail.com' primary='true' />
<gd:email rel='http://schemas.google.com/g/2005#home' address='liz#example.org' />
<gd:im address='liz#gmail.com' primary='true' protocol='http://schemas.google.com/g/2005#GOOGLE_TALK' rel='http://schemas.google.com/g/2005#home' />
<gd:phoneNumber rel='http://schemas.google.com/g/2005#work' primary='true'>(206)555-1212</gd:phoneNumber>
<gd:phoneNumber rel='http://schemas.google.com/g/2005#home'>(206)555-1213</gd:phoneNumber>
</entry>"
Does anyone know what might cause this?
Thank you.

After opening a ticket with Google, they gave me the following guidance. Upon implementing the new sample XML, I was able to create a new shared contact with a title. That met my needs.
Here is what I received:
In regard to the issue you are experiencing I was able to test and
replicate the behavior that you are encountering. Whenever I follow
the example the Shared Contact is created but part of the contact
information is not complete. I will proceed to report this immediately
in order to update the Article that you are referring.
After investigating and running additional tests, I was able to make
the API work as expected and I was able to add a Domain Shared Contact
with most of the details. I noticed that the Domain Shared Contacts
API uses Google Data APIs to push the information to your domain. I
was able to find an official example from the Google Data APIs and it
seems to work as expected. You can check the example that I am
referring here
https://developers.google.com/gdata/docs/2.0/elements#examples
Below I am including the example that I used as a reference (Note that
I removed the "organization" part from the example provided on the
link above):
<entry xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005'>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/contact/2008#contact'/>
<title>Eliza Benne</title>
<content>My good friend, Liz. A little quick to judge sometimes, but nice girl.</content>
<gd:email rel='http://schemas.google.com/g/2005#work' primary='true' address='lizi#gmail.com'/>
<gd:email rel='http://schemas.google.com/g/2005#home' address='lizi#example.org'/>
<gd:phoneNumber rel='http://schemas.google.com/g/2005#work' primary='true'>
(206)555-1212
</gd:phoneNumber>
<gd:phoneNumber rel='http://schemas.google.com/g/2005#home'>
(206)555-1213
</gd:phoneNumber>
<gd:phoneNumber rel='http://schemas.google.com/g/2005#mobile'>
(206) 555-1212
</gd:phoneNumber>
<gd:im rel='http://schemas.google.com/g/2005#home'
protocol='http://schemas.google.com/g/2005#GOOGLE_TALK'
address='lizi#gmail.com'/>
<gd:postalAddress rel='http://schemas.google.com/g/2005#work' primary='true'>
1600 Amphitheatre Pkwy
Mountain View, CA 94043
</gd:postalAddress>
<gd:postalAddress rel='http://schemas.google.com/g/2005#home'>
800 Main Street
Mountain View, CA 94041
</gd:postalAddress>
</entry>
You should be able to use the above example and add external contacts
to your Shared Contacts directory. I will be more than happy to over
the steps with you to test this and make sure that the API is working
as expected. Note: Please make sure you are using GData-Version: 3.0.

Related

how can I deeplink an app from Google Assistant?

I'm creating a dialogflow agent integrated with Google Assistant.
What I'd like to do is to open an app (my app) when a proper intent is matched. I've seen that actions like Youtube, Spotify etc. are able to do that, for example I can tell the Youtube action "search for cats video" and the Youtube app will open with a list of cats videos.
I tried to use the DeepLink class but I then noticed it's deprecated.
DeepLink class
Is there any way you can suggest me to do this?
Thanks in advance
I think you are looking for App Actions. Here are the steps you need to follow:
Find the right built-in intent. actions.intent.OPEN_APP_FEATURE should be the right one for you.
Create and update actions.xml. It should look like
<?xml version="1.0" encoding="UTF-8"?>
<!-- This is a sample actions.xml -->
<actions>
<action intentName="actions.intent.OPEN_APP_FEATURE">
<!-- Use url from inventory match for deep link fulfillment -->
<fulfillment urlTemplate="{#url}" />
<!-- Define parameters with inventories here -->
<parameter name="feature">
<entity-set-reference entitySetId="featureParamEntitySet" />
</parameter>
</action>
<entity-set entitySetId="featureParamEntitySet">
<!-- Provide a URL per entity -->
<entity url="myapp://deeplink/one" name="featureParam_one" alternateName="#array/featureParam_one_synonyms" />
<entity url="myapp://deeplink/two" name="featureParam_two" alternateName="#array/featureParam_two_synonyms" />
</entity-set>
</actions>

Fhir Path Regex for valueDate

We recently started to use fhir path to validate a QuestionnaireResponse.
The QuestionnaireResponse is the following
<QuestionnaireResponse xmlns="http://hl7.org/fhir">
<questionnaire>
<reference value="..." />
</questionnaire>
<status value="completed" />
<authored value="2016-02-19T05:13:42.600Z" />
<group>
<question>
<linkId value="8d0db198-f341-43f8-9dd3-9151ace66375" />
<text value="date" />
<answer>
<valueDate value="2016-02-12" />
</answer>
</question>
</group>
</QuestionnaireResponse>
I have tried the following:
QuestionnaireResponse.group.question.answer.valueDate
and the answer was:
2016-02-12
However trying the following to validate the date with a regex throws exception
QuestionnaireResponse.group.question.answer.valueDate.matches("^\d{4}-((0\d)|(1[012]))-(([012]\d)|3[01])$")
it would be great if you may give me some idea of what is the best way to evaluate a date in fhir path
This turned out to be a bug in the .NET FluentPath evaluator that is in development still (regex section).
The FHIR server should also have rejected the value as not conforming without the fhirpath expression also.

Does UAA require the login-server to have scope uaa.user?

I've got a deployment where I'm running the UAA sample apps, along with the Java login-server. I've configured my UAA and login-server with a custom uaa.yml and login.yml, respectively. I've populated the uaa.yml based upon the details for the "login" client by looking at the contents of /uaa/uaa/src/main/webapp/WEB-INF/spring/oauth-clients.xml, as shown below:
<entry key="login">
<map>
<entry key="id" value="login" />
<entry key="secret" value="loginsecret" />
<entry key="scope" value="openid,uaa.user" />
<entry key="authorized-grant-types" value="client_credentials,authorization_code" />
<entry key="authorities" value="oauth.login" />
<entry key="autoapprove" value="true" />
</map>
</entry>
Configured this accordingly in my uaa.yml. This seemed to work fine, and I can log in and surf the sample app.
However, when I subsequently visited the /approvals page in the sample app, I got a javascript error in approvals.jsp which was apparently caused by the absence of any corresponding entry for scope.uaa.user in the messages.properties file.
[2013-03-20 18:05:52.787] login/login-server - ???? [http-8080-1] .... DEBUG --- DispatcherServlet: Could not complete request
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspTagException: No message found under code 'scope.uaa.user' for locale 'en_US'.
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1180)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
...
So, the question is -- is scope "uaa.user" really required by the login-server? And, if so, what should the entry in the messages.properties file say? I couldn't find any place that provided the agreed upon text description for uaa.user scope.
As a workaround, I've simply made up my own text for that scope in messages.properties, and the approvals page now renders OK.
Thanks,
John
Yes, the "uaa.user" is required by the login server. You can have any text string in the messages.properties file, which you will use in your application accordingly.
Let me know if that helps.
Thanks,
Hitesh
The login server can't predict what scopes are going to be available, as some may be custom to the application. The bug has been fixed here
https://github.com/cloudfoundry/login-server/commit/c39aa19db33c12a0d9740e2c0a53698b87889ebc
If no message is available to represent the scope, simply print out the name of the scope.

ASP.Net login control will not work with Intelligencia.UrlRewriter

I hope someone can help me shed some light on this nightmare I'm having...!
I have just complete an ASP.Net e-commerce website with the help of an Apress book; The BalloonShop project, some of you might already know the one.
Everything is fine and dandy apart from one niggle that I cant seen to sort out!
I cannot logout from my site using the asp.net login control from any page that does not have the .aspx extension in the Url. This is namely; Departments, Category and Products as these are using the Intelligencia.UrlRewriter to provide browser friendly url's.
My url's are rewritten perfectly, but when I try to logout from a page that is using the url rewriter it does not work, and I receive the following message in my error log email:
Exception generated on 22 February 2013, at 22:23
Page location: /Triple-x/Dynamo-p4/?
<div id=":143">ProductId=4
Message: The HTTP verb POST used to access path '/Triple-x/Dynamo-p4/' is not allowed.
Source: System.Web
Method: System.IAsyncResult BeginProcessRequest(System.Web.HttpContext, System.AsyncCallback, System.Object)
Stack Trace:
at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionSt ep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)</div>
In my web.config if have:
<configSections>
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler,Intelligencia.UrlRewriter" />
</configSections>
<rewriter>
<!-- Rewrite department pages -->
<rewrite url="^.*-d([0-9]+)/?$" to="~/Catalog.aspx?DepartmentID=$1" processing="stop" />
<rewrite url="^.*-d([0-9]+)/page-([0-9]+)/?$" to="~/Catalog.aspx?DepartmentID=$1&Page=$2" processing="stop" />
<!-- Rewrite category pages -->
<rewrite url="^.*-d([0-9]+)/.*-c([0-9]+)/?$" to="~/Catalog.aspx?DepartmentId=$1&CategoryId=$2" processing="stop" />
<rewrite url="^.*-d([0-9]+)/.*-c([0-9]+)/page-([0-9]+)/?$" to="~/Catalog.aspx?DepartmentId=$1&CategoryId=$2&Page=$3" processing="stop" />
<!-- Rewrite product details pages -->
<rewrite url="^.*-p([0-9]+)/?$" to="~/Product.aspx?ProductId=$1" processing="stop" />
</rewriter>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" />
<remove name="ScriptModule" />
<!--<add name="ScriptModule" preCondition="managedHandler" />-->
</modules>
</system.webServer>
I am also using IIS7 on my local machine, and have read that this can sometimes be the cause re: AppPool version. I have tried changing this to Classic ASP as suggested, but this did not work for me!
Does anyone know if this is a common problem when hosting on local machine and using Intelligencia.UrlRewriter? Would this possibly not be an issue if hosting on a shared web hosting server?
If I'm way off the mark then please forgive my naivety, as I am still quite new to this, especially projects of this size.
Thanks for you help!!
If you want to use url rooting you can use this codes. I use it also an e-commerce project:
in Global.asax file :
void Application_Start(object sender, EventArgs e)
{
if (RouteTable.Routes.Count <= 0)
{
RouteTable.Routes.Add("Urun", new Route("Urun/{category}/{name}/{prid}/{caid}", new PageRouteHandler("~/ProductDetail.aspx")));
RouteTable.Routes.Add("Kategori", new Route("Kategori/{upper}/{name}/{caid}", new PageRouteHandler("~/Categories.aspx")));
RouteTable.Routes.Add("Icerik", new Route("Icerik/{name}/{cpid}", new PageRouteHandler("~/ContentPage.aspx")));
}
}
And you can this codes wherever you want to give link:
var param = new RouteValueDictionary
{
{"category", "Oyuncak"},
{"prid", ((DiscountProductsResult) e.Item.DataItem).ProductId},
{"name", ((DiscountProductsResult) e.Item.DataItem).UrlView.Replace(" ", "-")},
{"caid", 0}
};
VirtualPathData path = RouteTable.Routes.GetVirtualPath(null, "Urun", param);
And you can get querystring values like this:
RouteData.Values["caid"]

Download specific version of a file from SharePoint using web services

Can someone provide a sample for downloading a specific version of a file from SharePoint using web services? Normally I would get the file with the Copy Web Service (.../_vti_bin/copy.asmx). But I don't really know how to specify a version.
Regards
Anton Kalcik
You can use the Versions web service to get which versions exist for a File
The GetVersions method will give you an xml like this:
<results xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<list id="{26E516B0-8241-4B97-984D-000000000000}" />
<versioning enabled="1" />
<settings url="http://Server_Name/Site_Name/_layouts/
1033/LstSetng.aspx?
List={26E516B0-8241-4B97-984D-000000000000}" />
<result version="#4" url="http://Server_Name/Site_Name/
Shared Documents/File_Name.doc"
created="6/7/2003 5:55 PM" createdBy="DOMAIN\User" size="19968"
comments="" />
<result version="1" url="http://Server_Name/Site_Name/
_vti_history/1/Shared Documents/File_Name.doc"
created="6/7/2003 5:49 PM" createdBy="DOMAIN\User" size="19968"
comments="" />
.
.
.
</results>
You can then just use a HTTP GET request for the content of the "url" attribute of the "result" node for the right version
Here's the exact thing you want to do, with code:
Article