Home › Forums › Autocomplete › Autocomplete using list url
Tagged: multilingual
- This topic has 4 replies, 2 voices, and was last updated 7 years, 6 months ago by Andreas Blüher.
-
AuthorPosts
-
-
April 7, 2017 at 08:56 #16298
Hello,
I was wondering if you got any plans to support the usage of url (aka rootfolder name of the list) like you do for vLookup? We’re working on a multilingual application with site collections in different languages and want to pre define the configuration.
-
May 8, 2017 at 18:46 #16497
Hi,
Sorry, this one slipped past me. I’ll see if I can get this added, but in the meantime you can use the GUID – if your sites are not created from templates – if so, the GUID will be generated for each site.Alexander
-
May 9, 2017 at 13:46 #16506
Hi,
thank you for your response. We can’t use guid, because we got several SharePoint Servers (dev, test, prd) and we move configurations from one to another. Do you have some best practices regarding this kind of scenario, because even using only url in DFFS we got an external system which is referenced. Therefor we need different urls for test and prd to the external system, which is not possible right now and includes a lot of manuell changes after deploying from Test to Prod.
Regards
Andreas -
May 9, 2017 at 20:31 #16510
If you are using SharePoint 2013 / 2016 you can use this function to get the GUID from the URL name of the list – please note that the URL name is case sensitive.
function getListByRootFolder(argObj){ jQuery.ajax({ url:argObj.listBaseUrl+"/_api/Web/Lists?$filter=RootFolder/Name eq '"+argObj.listUrlName+"'", type:"GET", headers: { "Accept": "application/json; odata=verbose" }, success: function (data) { var r = {"success":false}; if(data.d.results.length > 0){ r = data.d.results[0]; } if(typeof argObj.callback === "function"){ argObj.callback(r); } }, error: function (data) { if(typeof argObj.callback === "function"){ argObj.callback("getListByRootFolder:An error occurred"); } } }); }
Use it like this:
getListByRootFolder({ "listBaseUrl":"/sites/your_site", "listUrlName":"ListNameFromURL", "callback":function(list){ var GUID = list.Id; // Put the code you where you want to use the GUID here. } });
Change “listBaseUrl” and “listUrlName” to match your list.
Hope you can use this,
Alexander -
May 10, 2017 at 08:21 #16520
Hello Alexander,
thank you very much for the code example and I can modify it for my needs and it will work out for me. I’m a colleague of Ferdi Lethen and responsible for lists without “/lists/” prefix (which apperently is possible programmatically). I can remove /lists/ from your code and it will work afterwards.
Thank you very much
-
-
AuthorPosts
- You must be logged in to reply to this topic.