Can't get SingleValueExtendedProperties from EXO Message with GRAPH - microsoft-graph-api

For reference, I read:
Can't get SingleValueExtendedProperties from Outlook contacts for certain data types with GRAPH
Yes, I see that this thread is pretty old, but I hope you will still assist. So I was trying to execute a similar query:
https://graph.microsoft.com/v1.0/me/mailfolders/sentitems/messages/AAAB[truncated]BAAA=?$expand=singleValueExtendedProperties($filter=id%20eq%20'String%200x5D01001E')
This is just POC at the moment as I was noticing the String Comments by Marc in the refered article. This particular property is
Tag: 0x5D01001E
Type: PT_STRING8
Property Name: PR_SENDER_SMTP_ADDRESS_A
Other Names: PR_SENDER_SMTP_ADDRESS, PidTagSenderSmtpAddress, PR_SENDER_SMTP_ADDRESS_W, ptagSenderSMTPAddress
DASL: http://schemas.microsoft.com/mapi/proptag/0x5D01001E
I really would like the Binary property:
Tag: 0x00360003
Type: PT_LONG Property
Name: PR_SENSITIVITY Other
Names: PidTagSensitivity,ptagSensitivity
DASL: http://schemas.microsoft.com/mapi/proptag/0x00360003
When trying either, the query runs without error, but I do not get the MAPI Property. I switched to the PTString8 property PR_SENDER_SMTP_ADDRESS to prove I can get a String, but Eric's post in the referred document seem to make me think he could get a Non String. Both queries run, but no MAPI Property.
Any help would be welcomed. Thanks!

I figured it out! (Also, note that my first example PR_SENDER_SMTP_ADDRESS 0x5D01, is undefined in Sentitems Folder).
*Please Note:
0x0036 = PR_SENSITIVITY
https://graph.microsoft.com/v1.0/me/messages/{MessageID}?$expand=singleValueExtendedProperties($filter=id eq 'Integer 0x0036')
*Substitute the {MessageID} to be the Message Id of the Mail Message in question.

Related

Add term to listItem in Microsoft Graph API

How do I add a term to a listItem in Microsoft Graph API?
For simple String types (ProductSegment in the example) I do the following:
PATCH https://graph.microsoft.com/v1.0/sites/{{sharepoint_site_id}}/lists/{{sharepoint_list_id}}/items/{{num}}/fields
{
"DisplayedName": "asdasfsvsvdvsdbvdfb",
"DocumentType": "FLYER",
"ProductSegment": ["SEG1"],
"TEST_x0020_2_x0020_ProductSegment": [{
"TermGuid": "c252c37d-1fa3-4860-8d3e-ff2cdde1f673"
}],
"Active": true,
"ProductSegment#odata.type": "Collection(Edm.String)",
"TEST_x0020_2_x0020_ProductSegment#odata.type": "Collection(Edm.Term)"
}
Obviously it won't work for TEST_x0020_2_x0020_ProductSegment. But I just cannot find any hints in the documentation.
I got one step closer thanks to the duplicated issue. First I found the name (not the id) of the hidden field TEST 2 ProductSegment_0 (notice the _0 suffix). Then assembled the term value to send: -1;#MyLabel|c352c37d-1fa3-4860-8d3e-ff2cdde1f673.
PATCH https://graph.microsoft.com/v1.0/sites/{{sharepoint_site_id}}/lists/{{sharepoint_list_id}}/items/{{num}}/fields
{
"DisplayedName": "asdasfsvsvdvsdbvdfb",
"DocumentType": "FLYER",
"ProductSegment": ["SEG1"],
"i9da5ea20ec548bfb2097f0aefe49df8": "-1;#MyLabel|c352c37d-1fa3-4860-8d3e-ff2cdde1f673",
"Active": true,
"ProductSegment#odata.type": "Collection(Edm.String)"
}
and so I can add one item. I would need to add multiple, so I wanted to add the values to an array and set the field type (i9da5ea20ec548bfb2097f0aefe49df8#odata.type) to Collection(Edm.String).
Now I get an error with the code generalException as opposed to an invalidRequest.
As far as I know, graph API does not support updating SharePoint taxonomy. For now, you can go with classic SharePoint REST API for example to accomplish "advanced" things like updating taxonomy terms. Probably a duplicate of: Can't Update Sharepoint Managed Meta Data Field from Microsoft Graph Explorer
Finally I got it.
Thanks #Nikolay for the linked issue.
As I also added this to the end of the question, first you need the name (not the id!) of the hidden field TEST 2 ProductSegment_0 (notice the _0 suffix). Then assemble the term values to send: -1;#MyLabel|c352c37d-1fa3-4860-8d3e-ff2cdde1f673 and -1;#SecondLabel|1ef2af46-1fa3-4860-8d3e-ff2cdde1f673, and separate them with ;# (actually the content of the label is irrelevant but some string needs to be there).
Looks utterly ridiculous but works.
PATCH https://graph.microsoft.com/v1.0/sites/{{sharepoint_site_id}}/lists/{{sharepoint_list_id}}/items/{{num}}/fields
{
"DisplayedName": "asdasfsvsvdvsdbvdfb",
"DocumentType": "FLYER",
"ProductSegment": ["SEG1"],
"i9da5ea20ec548bfb2097f0aefe49df8": "-1;#MyLabel|c352c37d-1fa3-4860-8d3e-ff2cdde1f673";#-1;#SecondLabel|1ef2af46-1fa3-4860-8d3e-ff2cdde1f673,
"Active": true,
"ProductSegment#odata.type": "Collection(Edm.String)"
}

Google Slide API script updateShapeProperties autofit

Getting error "GoogleJsonResponseException: API call to slides.presentations.batchUpdate failed with error: Invalid requests[3].updateShapeProperties: Invalid field: autofit_type"
but I think my code is right:
'updateShapeProperties': {
'objectId': pageElementId,
'fields': 'autofitType',
'shapeProperties': {
'autofit': {
'autofitType':'SHAPE_AUTOFIT'
}
}
}
Any help much appreciated
Cheers
Greg
I thought that the error message means that the value of fields is not correct. In your script, how about modifying as follows.
From:
'fields': 'autofitType',
To:
'fields': 'autofit.autofitType',
Note:
But, in the current stage, it seems that the value of autofitType can only use NONE. So, when SHAPE_AUTOFIT and TEXT_AUTOFIT is used for autofitType, an error of Autofit types other than NONE are not supported. occurs. Please be careful this.
About this, it seems that this is not reported as the future request in the issue tracker. So how about reporting it as the future request? Ref
When you test above modification, please modify 'autofitType':'SHAPE_AUTOFIT' to 'autofitType':'NONE'. By this, the request occurs no error.
Reference:
AutofitType
You're using an invalid field as what the error message says.
You can refer here for the available fields that can be used to replace your 'autofitType' field.
In response to Jason E. response, please see the documented Enum for AutofitType 1

Array.size() returned wrong values (Grails)

I'm developing an app using Grails. I want to get length of array.
I got a wrong value. Here is my code,
def Medias = params.medias
println params.medias // I got [37, 40]
println params.medias.size() // I got 7 but it should be 2
What I did wrong ?
Thanks for help.
What is params.medias (where is it being set)?
If Grials is treating it as a string, then using size() will return the length of the string, rather than an array.
Does:
println params.medias.length
also return 7?
You can check what Grails thinks an object is by using the assert keyword.
If it is indeed a string, you can try the following code to convert it into an array:
def mediasArray = Eval.me(params.medias)
println mediasArray.size()
The downside of this is that Eval presents the possibility of unwanted code execution if the params.medias is provided by an end user, or can be maliciously modified outside of your compiled code.
A good snippet on the "evil (or lack thereof) of eval" is here if you're interested (not mine):
https://javascriptweblog.wordpress.com/2010/04/19/how-evil-is-eval/
I think 7 is result of length of the string : "[37,40]"
Seems your media variable is an array not a collection
Try : params.medias.length
Thanks to everyone. I've found my mistake
First of all, I sent an array from client and my params.medias returned null,so I converted it to string but it is a wrong way.
Finally, I sent and array from client as array and in the grails, I got a params by
params."medias[]"
List medias = params.list('medias')
Documentation: http://grails.github.io/grails-doc/latest/guide/single.html#typeConverters

Is MetroCriteriaId an integer or a string?

The Google documentation for the GeoPerformance report is a little confusing. On the one hand it says that MetroCriteriaId is of Type Integer but in the Notes it says Name of the metro as a string.
Do anyone know which one is correct, or do I just suck it and see?
It doesn't seem to matter what it is, Int or String, as even in 80812-line report the field is empty. The report definition I used is below and I got data for everything except MetroCriteriaId. Dead field? No idea.
<reportDefinition xmlns="https://adwords.google.com/api/adwords/cm/v201406">
<selector>
<fields>AccountCurrencyCode</fields>
<fields>AccountDescriptiveName</fields>
<fields>AccountTimeZoneId</fields>
<fields>AdFormat</fields>
<fields>AdGroupId</fields>
<fields>AdGroupName</fields>
<fields>AdGroupStatus</fields>
<fields>AdNetworkType1</fields>
<fields>AdNetworkType2</fields>
<fields>AverageCpc</fields>
<fields>AverageCpm</fields>
<fields>AveragePosition</fields>
<fields>CampaignId</fields>
<fields>CampaignName</fields>
<fields>CampaignStatus</fields>
<fields>CityCriteriaId</fields>
<fields>Clicks</fields>
<fields>Conversions</fields>
<fields>Cost</fields>
<fields>CostPerConversion</fields>
<fields>CostPerConversionManyPerClick</fields>
<fields>CountryCriteriaId</fields>
<fields>Ctr</fields>
<fields>CustomerDescriptiveName</fields>
<fields>Date</fields>
<fields>DayOfWeek</fields>
<fields>Device</fields>
<fields>ExternalCustomerId</fields>
<fields>Impressions</fields>
<fields>IsTargetingLocation</fields>
<fields>LocationType</fields>
<fields>MetroCriteriaId</fields>
<fields>Month</fields>
<fields>MonthOfYear</fields>
<fields>MostSpecificCriteriaId</fields>
<fields>PrimaryCompanyName</fields>
<fields>Quarter</fields>
<fields>RegionCriteriaId</fields>
<fields>ValuePerConversion</fields>
<fields>ValuePerConversionManyPerClick</fields>
<fields>ViewThroughConversions</fields>
<fields>Week</fields>
<fields>Year</fields>
<dateRange>
<min>20140601</min>
<max>20140630</max>
</dateRange></selector>
<reportName>Custom Geo Performance Report</reportName>
<reportType>GEO_PERFORMANCE_REPORT</reportType>
<dateRangeType>CUSTOM_DATE</dateRangeType>
<downloadFormat>TSV</downloadFormat>
</reportDefinition>

XSLT 2.0. Loop inside a Function

Hitting my wall here...
I've got the following data where a Primary Employee may have multiple dependents. I need to create a function that will match the Employee's SSN (ab:SSN) against the Dependent_SSN and determine if one of them is a 'Spouse'. If so, then we'll return the Dependent_SSN of the 'Spouse'.
If not, we'll move on and return the next non-'Spouse' Dependent_SSN.
I'm trying to create a function as I think I'll need this more than once. The code snippet resides inside of an existing template that is doing other looping functionality.
I've tried this but Oxygen returns an error:
<xsl:function name="ab:PQB">
<xsl:param name="EE_SSN">
</xsl:param>
<xsl:for-each select="/ab:Report_Data/ab:Report_Entry[ab:Employee_ID=$EE_SSN]/ab:Report_Data/ab:Report_Entry[ab:Employee_ID=$EE_SSN]ab:dependents/ab:Dependent_SSN">
</xsl:for-each>
The Error returned is :
"Engine name: Saxon-PE 9.3.0.5
Severity: fatal
Description: Unexpected token name "wd:dependents" beyond end of expression"
I know I need to test the higher level SSN against looping through the dependents, but like I said "I'm against my wall" :)
Data is here:
<ab:Report_Entry>
<ab:SSN>888881006</ab:SSN>
<ab:Last_Name>Smith</ab:Last_Name>
<ab:First_Name>Kimberly</ab:First_Name>
<ab:dependents>
<ab:Dependent_SSN>888881009</ab:Dependent_SSN>
<ab:Relation ab:Descriptor="Spouse">
</ab:Relation>
</ab:dependents>
<ab:dependents>
<ab:Dependent_SSN>888881004</ab:Dependent_SSN>
<ab:Relation ab:Descriptor="Child">
</ab:Relation>
</ab:dependents>
<ab:dependents>
<ab:Dependent_SSN>888881003</ab:Dependent_SSN>
<ab:Relation ab:Descriptor="Child">
<ab:ID ab:type="Related_Person_Relationship_ID">Child</ab:ID>
</ab:Relation>
</ab:dependents>
<ab:dependents>
<ab:Dependent_SSN>888881001</ab:Dependent_SSN>
<ab:Dependent_ID>1032D-4</ab:Dependent_ID>
<ab:Relation ab:Descriptor="Child">
<ab:ID ab:type="Related_Person_Relationship_ID">Child</ab:ID>
</ab:Relation>
</ab:dependents>
</ab:Report_Entry>
Thank you to any advice!
You might want to define the type of the input parameter and the type of the function result and then you should write a function body returning a value of that type. Currently your description sounds rather procedural, that is not going to work with XSLT/XPath.
As for the error, I think in the path /ab:Report_Data/ab:Report_Entry[ab:Employee_ID=$EE_SSN]/ab:Report_Data/ab:Report_Entry[ab:Employee_ID=$EE_SSN]ab:dependents/ab:Dependent_SSN you need one more slash /ab:Report_Data/ab:Report_Entry[ab:Employee_ID=$EE_SSN]/ab:Report_Data/ab:Report_Entry[ab:Employee_ID=$EE_SSN]/ab:dependents/ab:Dependent_SSN to have a syntactically correct path. That should avoid the syntax error you get but is not likely to return the result you want.

Resources