I have two managed metadata fields in my list, they both can have multiple values, the first one is 'mm' and the second one has a danish symbol Ø - 'mm_Ø'.
I fetch the fields information using SharePoint REST API endpoint:
GET https://{tenant}.sharepoint.com/{site-path}/_api/Web/Lists(guid'{list-id}')/fields
In the response I see my fields definitions:
The 'mm' field is:
{
"odata.type": "SP.Taxonomy.TaxonomyField",
***
"CanBeDeleted": true,
"ClientSideComponentId": "00000000-0000-0000-0000-000000000000",
"ClientSideComponentProperties": null,
"ClientValidationFormula": null,
"ClientValidationMessage": null,
"CustomFormatter": null,
"DefaultFormula": null,
"DefaultValue": "",
"Description": "",
"Direction": "none",
"EnforceUniqueValues": false,
"EntityPropertyName": "mm",
"Filterable": true,
"FromBaseType": false,
"Group": "Custom Columns",
"Hidden": false,
"Id": "f863fab3-5611-4d81-82f9-299c42e6258c",
"Indexed": false,
"IndexStatus": 0,
"InternalName": "mm",
"JSLink": "SP.UI.Taxonomy.js|SP.UI.Rte.js(d)|SP.Taxonomy.js(d)|ScriptForWebTaggingUI.js(d)",
"PinnedToFiltersPane": false,
"ReadOnlyField": false,
"Required": false,
"SchemaXml": "***",
"Scope": ***,
"Sealed": false,
"ShowInFiltersPane": 0,
"Sortable": false,
"StaticName": "mm",
"Title": "mm",
"FieldTypeKind": 0,
"TypeAsString": "TaxonomyFieldTypeMulti",
"TypeDisplayName": "Managed Metadata",
"TypeShortDescription": "Managed Metadata",
"ValidationFormula": null,
"ValidationMessage": null,
"AllowMultipleValues": true,
"DependentLookupInternalNames": [],
"IsDependentLookup": false,
"IsRelationship": true,
"LookupField": "Term$Resources:core,Language;",
"LookupList": "{6eaf0d27-f293-4017-bac5-b3ef9b3fe079}",
"LookupWebId": "e0087d65-0dcb-41a5-bb7c-c4b2f94fed59",
"PrimaryFieldId": null,
"RelationshipDeleteBehavior": 0,
"UnlimitedLengthInDocumentLibrary": false,
"AnchorId": "00000000-0000-0000-0000-000000000000",
"CreateValuesInEditForm": false,
"IsAnchorValid": true,
"IsKeyword": false,
"IsPathRendered": false,
"IsTermSetValid": true,
"Open": true,
"SspId": "a1796552-9a87-4f1d-95d5-b4a3fc8f143d",
"TargetTemplate": null,
"TermSetId": "8ed8c9ea-7052-4c1d-a4d7-b9c10bffea6f",
"TextField": "93148f4a-853f-4851-a600-3f76b38d030a",
"UserCreated": false
}
And the 'mm_Ø' field:
{
"odata.type": "SP.Taxonomy.TaxonomyField",
***
"AutoIndexed": false,
"CanBeDeleted": true,
"ClientSideComponentId": "00000000-0000-0000-0000-000000000000",
"ClientSideComponentProperties": null,
"ClientValidationFormula": null,
"ClientValidationMessage": null,
"CustomFormatter": null,
"DefaultFormula": null,
"DefaultValue": "",
"Description": "",
"Direction": "none",
"EnforceUniqueValues": false,
"EntityPropertyName": "mm__x00d8_",
"Filterable": true,
"FromBaseType": false,
"Group": "Custom Columns",
"Hidden": false,
"Id": "8b6cb6c7-5bdf-4e87-95e0-8ad6db1bc60e",
"Indexed": false,
"IndexStatus": 0,
"InternalName": "mm__x00d8_",
"JSLink": "SP.UI.Taxonomy.js|SP.UI.Rte.js(d)|SP.Taxonomy.js(d)|ScriptForWebTaggingUI.js(d)",
"PinnedToFiltersPane": false,
"ReadOnlyField": false,
"Required": false,
"SchemaXml": "***",
"Scope": ***,
"Sealed": false,
"ShowInFiltersPane": 0,
"Sortable": false,
"StaticName": "mm__x00d8_",
"Title": "mm_Ø",
"FieldTypeKind": 0,
"TypeAsString": "TaxonomyFieldTypeMulti",
"TypeDisplayName": "Managed Metadata",
"TypeShortDescription": "Managed Metadata",
"ValidationFormula": null,
"ValidationMessage": null,
"AllowMultipleValues": true,
"DependentLookupInternalNames": [],
"IsDependentLookup": false,
"IsRelationship": true,
"LookupField": "Term$Resources:core,Language;",
"LookupList": "{6eaf0d27-f293-4017-bac5-b3ef9b3fe079}",
"LookupWebId": "e0087d65-0dcb-41a5-bb7c-c4b2f94fed59",
"PrimaryFieldId": null,
"RelationshipDeleteBehavior": 0,
"UnlimitedLengthInDocumentLibrary": false,
"AnchorId": "00000000-0000-0000-0000-000000000000",
"CreateValuesInEditForm": false,
"IsAnchorValid": true,
"IsKeyword": false,
"IsPathRendered": false,
"IsTermSetValid": true,
"Open": true,
"SspId": "a1796552-9a87-4f1d-95d5-b4a3fc8f143d",
"TargetTemplate": null,
"TermSetId": "8ed8c9ea-7052-4c1d-a4d7-b9c10bffea6f",
"TextField": "b658e553-725e-4e24-9a6a-c911b50d68a4",
"UserCreated": false
}
Now, I want to create an item in that list using REST endpoint:
POST https://{tenant}.sharepoint.com/{site-path}/_api/Web/Lists(guid'{list-id}')/items
First I try to create an item only filling the mm field
Body:
{
"Title": "Item1",
"f863fab356114d8182f9299c42e6258c": "taxonomy|24a5a5fa-7a1d-48d6-8a2d-7937429dfd71;taxonomy2|23901385-e142-458c-85f2-4b5ca5dbd812"
}
And it works. Now I want to do the same but filling the 'mm_Ø' field.
Body:
{
"Title": "ee",
"l910ce92c882443cb3134a7aeed731f7": "taxonomy|24a5a5fa-7a1d-48d6-8a2d-7937429dfd71;taxonomy2|23901385-e142-458c-85f2-4b5ca5dbd812"
}
The response I get:
{
"odata.error": {
"code": "-2130575340, Microsoft.SharePoint.SPException",
"message": {
"lang": "en-US",
"value": "One or more field types are not installed properly. Go to the list settings page to delete these fields."
}
}
}
Does it mean that having symbols other than English in the Managed Metadata causes SharePoint REST API to fail?
From what I can tell, if the meta data field title is too long (each non-standard English letter is 8 letters) then we are getting this error.
Couldn't find a solution except renaming to something shorter/no special characters.
Another solution is to use this new API:
https://[tenant].sharepoint.com/sites/test/_api/web/GetList(#a1)/AddValidateUpdateItemUsingPath()?#a1=%27%2Fsites%2Ftest%2FLists%2FMyList%27
=== update ===
Found a solution, might help you.
In our case, the hidden note field's title was created with wrong value.
it suppose to be "[meta data title]_0" but the special characters were cut off.
If I manually updated the hidden note field's title to "[meta data title]_0" the update works as expected.
It leads me to believe the API in the back end is relying on the field title instead of internal name/TextField property to map the value from the note field back to the meta data field.
Related
I'm using CDK to create a custom resource using lambda, the lambda deploys a Lex bot,
the lambda imports a zip bot file which it then uploads to pre signed s3 URL,
but the bot fails in the import step and getting validation error for AMAZON.FallbackIntent.
failureReasons: [
"Couldn't import the bot. AMAZON.FallbackIntent doesn't support extending the intent confirmation setting and the dialog code hook. Validation error occurred at Intent FallbackIntent for Locale en_US. Check the value and try your request again."
],
and this is the fallback intent json for the bot.
{
"name": "FallbackIntent",
"identifier": "FALLBCKINT",
"description": "Default intent when no other intent matches",
"parentIntentSignature": "AMAZON.FallbackIntent",
"sampleUtterances": null,
"intentConfirmationSetting": null,
"intentClosingSetting": null,
"initialResponseSetting": {
"initialResponse": null,
"codeHook": {
"isActive": true,
"enableCodeHookInvocation": true,
"invocationLabel": null,
"postCodeHookSpecification": {
"failureResponse": null,
"failureNextStep": {
"dialogAction": {
"type": "EndConversation",
"slotToElicit": null,
"suppressNextMessage": null
},
"sessionAttributes": null,
"intent": null
},
"failureConditional": null,
"successConditional": null,
"timeoutResponse": null,
"timeoutNextStep": {
"dialogAction": {
"type": "EndConversation",
"slotToElicit": null,
"suppressNextMessage": null
},
"sessionAttributes": null,
"intent": null
},
"timeoutConditional": null,
"successNextStep": {
"dialogAction": {
"type": "EndConversation",
"slotToElicit": null,
"suppressNextMessage": null
},
"sessionAttributes": null,
"intent": null
},
"successResponse": null
}
},
"conditional": null,
"nextStep": {
"dialogAction": {
"type": "InvokeDialogCodeHook",
"slotToElicit": null,
"suppressNextMessage": null
},
"sessionAttributes": null,
"intent": null
}
},
"inputContexts": null,
"outputContexts": null,
"kendraConfiguration": null,
"dialogCodeHook": {
"enabled": true
},
"fulfillmentCodeHook": null,
"slotPriorities": []
}
can anyone help me with this,
I am doing an exercise where the goal it's to match my current calendar with other users.
To do this, I created a UserProfile App and Schedule App. Each user has a profile that can have multiple intervals.
Considering my current calendar:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 3,
"user": {
"id": 3,
"username": "john.doe",
"first_name": "John",
"last_name": "Doe"
},
"calendar": [
{
"id": 1,
"mon": true,
"tue": true,
"wed": true,
"thu": true,
"fri": true,
"sat": true,
"sun": true,
"start_date": "09:30",
"end_date": "12:20"
},
{
"id": 2,
"mon": true,
"tue": true,
"wed": true,
"thu": true,
"fri": true,
"sat": true,
"sun": true,
"start_date": "14:00",
"end_date": "23:00"
}
]
}
]}
When I am doing a call to the endpoint /api/search/users it returns all User Profiles with info from each user.
example:
{
"count": 99,
"next": "http://localhost:8000/api/search/users?page=2",
"previous": null,
"results": [
{
"id": 1,
"user": {
"id": 1,
"username": "john.bender.99",
"first_name": "John",
"last_name": "Bender"
},
"calendar": [
{
"id": 2,
"mon": true,
"tue": true,
"wed": true,
"thu": false,
"fri": true,
"sat": false,
"sun": false,
"start_date": "09:30",
"end_date": "12:20"
},
{
"id": 55,
"mon": false,
"tue": true,
"wed": true,
"thu": false,
"fri": true,
"sat": false,
"sun": false,
"start_date": "14:30",
"end_date": "19:20"
}
]
}
]}
Now, what I want to do actually is a search for related users with my calendar to know what days/hours we have a match.
When I do a call to this endpoint /api/search/users?related=self, I want to see this
{
"count": 2,
"results": [
{
"id": 87,
"user": {
"id": 87,
"username": "diana.taller",
"first_name": "Diana",
"last_name": "Taller"
},
"calendar": [
{
"id": 2,
"mon": true,
"tue": true,
"wed": true,
"thu": false,
"fri": true,
"sat": false,
"sun": false,
"start_date": "10:30",
"end_date": "11:20"
},
{
"id": 55,
"mon": false,
"tue": true,
"wed": true,
"thu": false,
"fri": true,
"sat": false,
"sun": false,
"start_date": "16:30",
"end_date": "17:20"
}
]
},{
"id": 128,
"user": {
"id": 128,
"username": "therockjosh",
"first_name": "Josh",
"last_name": "Bail"
},
"calendar": [
{
"id": 2,
"mon": false,
"tue": false,
"wed": false,
"thu": false,
"fri": true,
"sat": false,
"sun": false,
"start_date": "10:30",
"end_date": "11:20"
},
{
"id": 55,
"mon": false,
"tue": false,
"wed": false,
"thu": false,
"fri": true,
"sat": true,
"sun": true,
"start_date": "14:30",
"end_date": "17:00"
}
]
}
]}
The interception between my availability and from users is done between per day and then each interval to see when we have a match.
Inside my Search App, I created this
if related == "self":
current_user_profile = UserProfile.objects.filter(user=self.request.user)
related_users = UserProfile.objects.filter(calendar__in=current_user_profile.calendar.all())
return related_users
If I call current_user_profile, returns me the current user data as I provided you before.
If I call UserProfile.objects.all(), returns me the user's data as I provided you before.
But for some reason, I can't call calendar from current_user_profile.calendar as this image shows.
Is anyone have some idea how could I do this?
I think you need to use get function if you wanna get the object.
if related == "self":
# not UserProfile.objects.filter in order to get the UserProfile object.
current_user_profile = UserProfile.objects.get(user=self.request.user)
related_users = UserProfile.objects.filter(calendar__in=current_user_profile.calendar.all())
return related_users
Here we have the solution I found to exclude my user from the search.
current_user_profile = UserProfile.objects.get(user=self.request.user)
related_users = UserProfile.objects\
.filter(calendar__in=current_user_profile.calendar.all()) \
.exclude(user_id=current_user_profile.id)
return related_users
I have the following JSON stream coming from Twitter.
{
"created_at": "Thu Sep 27 21:02:00 +0000 2018",
"id": 1045418301336244224,
"id_str": "1045418301336244224",
"text": "Conditional Branching Now Supported in AWS Systems Manager Automation - #awscloud #amazon #aws",
"source": "Buffer",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"in_reply_to_screen_name": null,
"user": {
"id": 14687423,
"id_str": "14687423",
"name": "Casey Becking",
"screen_name": "caseybecking",
"location": "Huntington Beach, CA",
"url": "http://caseybecking.com",
"description": "I do stuff with computers for #rackspace , geek at heart! play and watch to much hockey, someday I'll make a personal website.",
"translator_type": "none",
"protected": false,
"verified": false,
"followers_count": 4191,
"friends_count": 2412,
"listed_count": 90,
"favourites_count": 794,
"statuses_count": 12995,
"created_at": "Wed May 07 15:03:23 +0000 2008",
"utc_offset": null,
"time_zone": null,
"geo_enabled": true,
"lang": "en",
"contributors_enabled": false,
"is_translator": false,
"profile_background_color": "000000",
"profile_background_image_url": "http://abs.twimg.com/images/themes/theme15/bg.png",
"profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme15/bg.png",
"profile_background_tile": false,
"profile_link_color": "ABB8C2",
"profile_sidebar_border_color": "000000",
"profile_sidebar_fill_color": "000000",
"profile_text_color": "000000",
"profile_use_background_image": false,
"profile_image_url": "http://pbs.twimg.com/profile_images/981617292546060289/RMX0GQFe_normal.jpg",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/981617292546060289/RMX0GQFe_normal.jpg",
"profile_banner_url": "https://pbs.twimg.com/profile_banners/14687423/1439137746",
"default_profile": false,
"default_profile_image": false,
"following": null,
"follow_request_sent": null,
"notifications": null
},
"geo": null,
"coordinates": null,
"place": null,
"contributors": null,
"is_quote_status": false,
"quote_count": 0,
"reply_count": 0,
"retweet_count": 0,
"favorite_count": 0,
"entities": {
"hashtags": [{
"text": "amazon",
"indices": [106, 113]
}, {
"text": "aws",
"indices": [114, 118]
}],
"urls": [{
"url": "",
"expanded_url": "https://buff.ly/2zwRyBx",
"display_url": "buff.ly/2zwRyBx",
"indices": [72, 95]
}],
"user_mentions": [{
"screen_name": "awscloud",
"name": "Amazon Web Services",
"id": 66780587,
"id_str": "66780587",
"indices": [96, 105]
}],
"symbols": []
},
"favorited": false,
"retweeted": false,
"possibly_sensitive": false,
"filter_level": "low",
"lang": "en",
"timestamp_ms": "1538082120628",
"emoticons": [],
"sentiments": "Neutral"
}
How do I parse, analyze and process this JSON using Kinesis Analytics?
The arrays should be flattened and this is very doable in Hive but need to do the same in Kinesis Analytics.
I am using Python to stream Twitter's Tweets via API. For example, the word "car" generates the following results:
{
"created_at": "Fri Sep 05 00:15:32 +0000 2014",
"id": 507683414255108096,
"id_str": "507683414255108096",
"text": "I put 'or nah' in my cousins car and Brenda & I are singing along a",
"source": "\u003ca href=\"http:\/\/www.cloudhopper.com\/\" rel=\"nofollow\"\u003eCloudhopper\u003c\/a\u003e",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"in_reply_to_screen_name": null,
"user": {
"id": 84729292,
"id_str": "84729292",
"name": "Tracy Ochoa",
"screen_name": "TracyMayy",
"location": "",
"url": "http:\/\/whythefuckinfucknot.tumblr.com",
"description": "New York 16 Instagram - TracyMayy Tumblr - http:\/\/whythefuckinfucknot.tumblr.com http:\/\/ask.fm\/tracyochoa",
"protected": false,
"verified": false,
"followers_count": 1045,
"friends_count": 453,
"listed_count": 22,
"favourites_count": 46035,
"statuses_count": 44720,
"created_at": "Sat Oct 24 00:42:23 +0000 2009",
"utc_offset": -14400,
"time_zone": "Eastern Time (US & Canada)",
"geo_enabled": true,
"lang": "en",
"contributors_enabled": false,
"is_translator": false,
"profile_background_color": "000000",
"profile_background_image_url": "http:\/\/pbs.twimg.com\/profile_background_images\/497215144607236096\/AharMORU.png",
"profile_background_image_url_https": "https:\/\/pbs.twimg.com\/profile_background_images\/497215144607236096\/AharMORU.png",
"profile_background_tile": true,
"profile_link_color": "000000",
"profile_sidebar_border_color": "FFFFFF",
"profile_sidebar_fill_color": "09B6D9",
"profile_text_color": "050505",
"profile_use_background_image": true,
"profile_image_url": "http:\/\/pbs.twimg.com\/profile_images\/504330955637919745\/JAHlbkiS_normal.jpeg",
"profile_image_url_https": "https:\/\/pbs.twimg.com\/profile_images\/504330955637919745\/JAHlbkiS_normal.jpeg",
"profile_banner_url": "https:\/\/pbs.twimg.com\/profile_banners\/84729292\/1409681919",
"default_profile": false,
"default_profile_image": false,
"following": null,
"follow_request_sent": null,
"notifications": null
},
"geo": null,
"coordinates": null,
"place": null,
"contributors": null,
"retweet_count": 0,
"favorite_count": 0,
"entities": {
"hashtags": [],
"trends": [],
"urls": [],
"user_mentions": [],
"symbols": []
},
"favorited": false,
"retweeted": false,
"possibly_sensitive": false,
"filter_level": "medium",
"lang": "en",
"timestamp_ms": "1409876132921"
}
It looks to me the Twitter user who wrote this tweet has an id "507683414255108096", is there a way to export Twitter's API Tweets with the username of the actual Twitter users who write the corresponding Tweets?
If not through API, do I need to actually follow the people to get streams of Tweets with usernames? Or is there another way around?
I am new to elasticsearch. I am trying to retrieve the selected fields from nested object returned by elasticsearch. Below is the object stored in elasticsearch index:
{
"_index": "xxx",
"_type": "user",
"_id": "2",
"_version": 1,
"exists": true,
"_source": {
"user": {
"user_auth": {
"username": "nickcoolster#gmail.com",
"first_name": "",
"last_name": "",
"is_active": false,
"_state": {
"adding": false,
"db": "default"
},
"id": 2,
"is_superuser": false,
"is_staff": false,
"last_login": "2012-07-10 21:11:53",
"password": "sha1$a6caa$cba2f821678ccddc4d70c8bf0c8e0655ab5c279b",
"email": "nickcoolster#gmail.com",
"date_joined": "2012-07-10 21:11:53"
},
"user_account": {},
"user_profile": {
"username": null,
"user_id": 2,
"following_count": 0,
"sqwag_count": 0,
"pwd_reset_key": null,
"_state": {
"adding": false,
"db": "default"
},
"personal_message": null,
"followed_by_count": 0,
"displayname": "nikhil11",
"fullname": "nikhil11",
"sqwag_image_url": null,
"id": 27,
"sqwag_cover_image_url": null
}
}
}
}
Now I want only certain fields to be returned from user.user_auth(like password,superuser etc should not be returned).
I am using django PyES and below is the code that i tried:
fields = ["user.user_auth.username","user.user_auth.first_name","user.user_auth.last_name","user.user_auth.email"]
result = con.search(query=q,indices="xxx",doc_types="user",fields=fields)
but the result that I get is only email being retrieved (i:e only last field being returned):
{
"user.user_auth.email": "nikhiltyagi.eng#gmail.com"
}
I want this abstraction for both the nested objects (i:e user_auth,user_profile)
how do I do this?
What about using latest django-haystack? It covers also ElasticSearch as a backend so you can get well binded ElasticSearch FTS to your project.