Tag Info

Hot answers tagged

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

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

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

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

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


3

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


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

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

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


1

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


1

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


1

Firstly welcome to SharePoint StackExchange. The GUIDs for Lists and Libraries can be identical on several sites as the site GUID is used in building up the access paths in the background. In short this should not impose a problem, infact it can actually be a benefit in some scenarios and I have from time to time given list types a static GUID in the list ...


1

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


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


1

If you are talking about the "Correlation" column in the log file, that info isn't related to the web application in any way (or at last - not in any documented way that I know of, it may still be possible that the ID is somehow calculated using some info from the web application identity). That said, the correlation identifier is simply a GUID that is ...


1

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


1

If what you are asking is to find the parent of a content type (such as thru code or such). A content type's ID shows inheretance. This is based on string concatenation with '00' as the seperator. This is generally in the form '0x[baseID]00[GUID (new id)]00[and so on]'. An example, the ID of the built in content type Item is 0x01, when inheriting from ...


1

I dont think this is possible -it wont be easy thats for sure.. Lists are referenced in alot of places, it could be in views, list web parts, custom code, even declarative provisioning logic, workflows... Even if you could, what would you do with the list? Not all guids would be possible to replace by code


1

Then I've got some bad news for you as the only way to find out the answers for many of these issues is to dive into the content database directly via SQL Server Management Studio. I know, I know, according to MS, you aren't supposed to ever go into the SQL database. Unfortunately, they provide horribly inadequate tools when it comes to the 2007-2010 ...



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