Hot answers tagged

23

The main advantage is a small performance benefit. Internally SharePoint is always using the GUID so the other methods have to find the GUID and the do the lookup using the GUID. The second advantage is that the user can't change the GUID.


10

Using Client Object Model will help in this case: var oList; function getListTitleById() { var clientContext = SP.ClientContext.get_current(); oList = clientContext.get_web().get_lists().getById(__ID of the list__); clientContext.load(oList,"Title"); clientContext.executeQueryAsync( Function.createDelegate(this, this....


10

You can use the below rest call as well.: Replace guid with your list guid. $.ajax({ url: _spPageContextInfo.siteAbsoluteUrl + "/_api/web/lists(guid 'b778bbec-dd69-4a6c-9437-c73972c36292')", method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: function (data) { console.log("List Title ...


8

You should try $libraries = $web.lists | Where-Object { $_.BaseType -Eq "DocumentLibrary" } $libraries | Format-Table title,id -AutoSize $lists = $web.lists | Where-Object { $_.BaseType -Eq "GenericList" } $lists | Format-Table title,id -AutoSize The key here, is the SPList.BaseType property. As decribed in the SPBaseType Enumeration, there are other ...


7

At least three options are available: Option 1 Retrieve File Url via projected File object: /_api/Web/Lists/getByTitle('<list title>')/items?$select=File/ServerRelativeUrl&$expand=File Option 2 Retrieve File Url via FileRef property: /_api/Web/Lists/getByTitle('<list title>')/items?$select=FieldValuesAsText/FileRef&$expand=...


6

Here is a script that gets the UniqueId of a list item: <script type="text/javascript"> $(document).ready(function() { ExecuteOrDelayUntilScriptLoaded( function() { var itemId = ....; // change to the real id var listTitle = .... // the list title var ctx = SP.ClientContext....


6

You can get it using REST query. The code should be: $( document ).ready(function() { GetListGuid('Lib1'); }); function GetListGuid(listTitle){ try { //REST Query to get the List Title jQuery.ajax( { url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('"+listTitle+"')?$select=Id", type: "GET", ...


5

Yes, you can specify it. Example: public static readonly Guid MyFieldId = new Guid("{CC1E421C-29BE-4373-81D0-55D5D64B2E3D}"); public static readonly string MyFieldDefXml = "<Field ID=\"{CC1E421C-29BE-4373-81D0-55D5D64B2E3D}\"" + " Name=\"MyFieldName\" StaticName=\"MyFieldName\"" + " Type=\"Text\" DisplayName=\"My Field Name\"" + " Group=\"My ...


5

Both Get-SPDatabase or Get-SPContentDatabase powershell cmdlets retrun database GUID (among other attributes), if called without parameters, try to use it.


5

SharePoint Template files (.stp) are not zip files. They are actually cabinet files - so the correct extension if you want to browse their content would be .cab, not .zip. Since you were able to rename the template file to .zip and extract its content, I assume you aren't using the default Windows archive manager but instead you are using some external tool -...


4

You can use following PowerShell command to know all your Web Application's GUIDs. Get-SPWebApplication | Select DisplayName, Id However, bear in mind that, the GUIDs for each item in ULS logs are unique (typically for one unit of operation - like one page request) and they do not correspond directly to GUIDs of web application, unless the log suggests so....


4

The name of the list is meaningless as there can be lists by the same name all over a site. You would need the Url to the list in order to be able to resolve it to a Guid. However, the mechanics of this vary wildly depending on what you mean by "programmatically". In PowerShell it would be something like this and the server object model would be similar. ...


4

If you know the name of the feature, you can retrieve the feature's definition ID by iterating the SPFeatureDefinitionCollection. Guid yourGuid; foreach (SPFeatureDefinition featureDef in web.FeatureDefinitions) { if (featureDef.DisplayName == "YourTitle" && featureDef.Scope == SPFeatureScope.Web) // Check the scope just to be safe { ...


4

Assuming it's a Document Library, you can use $expand to bring information from the File along with the query Should be something like this: /sites/mysite/_api/web/lists/getbytitle('Rotating%20Banner')/items?$select=Id,Title,File/ServerRelativeUrl&$expand=File


3

Yes the Guid of the default fields like Title, Author, Created etc. stays the same across machines. You can reference them with the SPBuiltInFieldId class. E.g.: SPBuiltInFieldId.Title will give you the Guid of the Title field.


3

To elaborate on the second advantage above, short of an item being deleted, you are guaranteed to receive the same object for the duration of your process. This makes it possible to do things like change any and all options with your list, and still be able to properly reference it, or more practically, you could update page links that go to a certain item, ...


3

SPListItem has 3 "Item" methods defined that take an identifier between brackets: item[string fieldName] item[int index] item[Guid fieldId] You seem to be trying to use item[Guid fieldId], but you are providing a string, not a Guid structure, so in effect you are calling item[string fieldName] and thus SharePoint expects a field name, not a field id. You ...


3

It's is not possible. The only ways to do this are: ClientContext(String) - Initializes a new instance of the ClientContext class for the SharePoint site with the specified absolute URL. ClientContext(Uri) - Initializes a new instance of the ClientContext class for the site with the specified Uri object. Link to source But you can use Site.OpenWebById() ...


3

The following should help, I haven't tested it yet.. $fieldId = [Guid]"fa564e0f-0c70-4ab9-b863-0177e6ddd247" $site = Get-SPSite("http://yoursite/") foreach($web in $site.AllWebs) { foreach($list in $web.Lists) { $fieldInUseList = $list.Fields | Where {$_.Id -eq $fieldId } if($fieldInUseCt) { Write-Host "'$web' web - ...


3

GUID The G in GUID stands for Globally The U in GUID stands for Unique The ID in GUID stands for Identifier https://en.wikipedia.org/wiki/Globally_unique_identifier And yes there is a once in a 30 octillion chance it is not unique What is an octillion ?? I don't know.. But it sounds huge, and maybe a good lock-out period (in milliseconds, we should ...


3

Microsoft guarantees you uniqueness inside a SharePoint-Database, not more and not less. Even considering it is a very small possibility to have duplicates, it is possible if you have multiple databases inside the same farm. https://msdn.microsoft.com/EN-US/library/microsoft.sharepoint.splistitem.uniqueid.aspx


3

Nice Solution added by @users1100 for SharePoint 2013. You can try JSOM also. It will work for both 2010 & 2013. var clientContext = new SP.ClientContext(); var oList = clientContext.get_web().get_lists().getByTitle('Name of List or Library'); clientContext.load(oList) clientContext.executeQueryAsync(function() { console.log(oList.get_id()) }, ...


3

We can also achieve this by using PnP JS library. This is open source javascript framework contains lot of utility and helper methods based on SharePoint REST API. <script type='text/javascript' src='https://raw.githubusercontent.com/SharePoint/PnP-JS-Core/master/dist/pnp.min.js'></script> Include pnp js file to your application and call the ...


2

No, the guid for the list is used directly by SharePoint to store items in the SQL-tables common to all site collections/sites in a Content database. If they allowed you to assign that yourselves it would cause problems of people storing information in multiple lists with the same Guid which SharePoint would the read for all of the lists. Which might also ...


2

I know I'm stating the obvious, but you'll want to use the title rather than the GUID if you are building a site template. So, no, the GUID is not always the best choice...


2

To generate a GUID (in Powershell) - $fooGuid = [guid]::NewGuid() Visual Studio also has the 'Create GUI' option under the Tools menu. This Powershell command (mentioned by Ashish above) gives you the Web App name and its ID (GUID) - $apps = Get-SPWebApplication | Select DisplayName, Id and to extend more to the above by using PowerShell with the ULS ...


2

Generating UUID/GUID is defined by RFC 4122. The description and an example to generate them is shown here - Generate GUID Online (in PHP but can be translated to other languages).


2

in the Server object model you can use. SPList list = SPWeb.Lists.TryGetList("YOurListName"); then you would already have the SPList the you can get the guid by using the ID property of the SPList SPList.ID


2

Usually in Visual Studio; Tools -> Generate GUID


2

Alexandar, To answer all your questions/doubts.. ID Column in Calculated Column Excerpt from Microsoft documentation You cannot reference the ID of a row for a newly inserted row. The ID does not yet exist when the calculation is performed. Using SharePoint Designer Workflow There are many posts which show solution to this problem using SharePoint ...


Only top voted, non community-wiki answers of a minimum length are eligible