Tag Info

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.


21

If you know the SPWeb but not the document library, you can use SPWeb.GetFile: SPFile file = web.GetFile(guid);


9

Simpliest case Consider you know that document is stored in standard "Shared Documents" library from the Team Site Template, you should use this code: var library = web.GetListFromUrl("http://site/Shared%20Documents/Forms/AllItems.aspx"); var file = library.Items[new Guid("137DA01F-9AFD-5d9d-80C7-02AF85C822A8")].File; // file.Url - site-relative url of the ...


5

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 ...


5

There's the SPList.GetItemByUniqueId function, but if you don't know which list to search you're out of luck. If you're using SharePoint 2010, look at the Document ID functionality (which attaches a unique ID to a list item and then uses Search to find the item). Depending upon your requirements, you might consider implementing ...


5

Run the Get-SPFeature Powershell against your 2007 environment and it'll kick out a list of all of your features resolving the GUIDs to the names. Powershell Commands to List SharePoint Features To James' point, it sounds like you missed a step or two in your upgrade planning. Make sure you're running Test-SPContentDatabase before you kick off the actual ...


4

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 ...


4

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 = ...


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 ...


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 { ...


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

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. ...


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

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


3

Unfortunately, it is not possible to assign your own GUID when you create a list.


2

One quick trick (which doesn't quite get you what you want, but will be helpful) is to add "?Contents=1" to the end of the URL for any page. This will show you the /_layouts/spcontnt.aspx page which displays all of the Web Parts which are on the page, including those which are closed. It's often the case that the issues are with closed Web Parts, and you can ...


2

Sadly, you can't. You probably make it work by using the title of the list to get its instance instead of its internal GUID.


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

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

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. ...


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

Usually in Visual Studio; Tools -> Generate GUID


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

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 ...


2

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 ...


2

I would use the Content Search Web Part. Using search is better than querying the list directly. Here is an example of setting up a Content Search Web Part Then you can set the search query to filter on the path of the item Path:[urloflist]/forms/dispform.aspx?id=[id] Then use one of the OOB display templates, or, if you prefer, create a custom display ...


1

Had the same problem. Applying SP1 did the trick


1

You could use the "Crawl Rules" on your Search Service Application to exclude the URLs based on the pattern you want to remove. For instance * { * - * - * - * - * } * (without the spaces) would exclude URLs that have a format like a GUID in them.


1

Features do not have a possible scope of 'List' so the specifics of how each feature affects lists is wholly dependent on what artifacts the feature itself adds. As such, there is no way to look for lists affected by a particular feature. Instead, you will need to know what it is specifically that is blocking the upgrade. If it is an outdated ...


1

Phil Childs has a some PowerShell scripts that can be helpful (some tweaking may be required in your case) - Removing features from a content database in SharePoint 2010 using PowerShell (use the -ReportOnly switch to list out the Features) Bulk deactivate feature and remove farm solution in PowerShell There are two other tools from CodePlex that can ...



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