How to Recover A Single Document In SharePoint

How to Recover A Single Document In SharePoint

  • How to Recover A Single Document In SharePoint

    Once upon a time at a customer site (August of last year, in fact), one of the users made some changes to an Excel document that he couldn’t roll back. Versioning was not enabled. He said he would lose like 60 hours of work if we couldn’t recover it. So here is what I did:

    On the SQL instance hosting the content database, I restored the 8/29/11 backup of “WSS_CustomerSite_Content” as WSS_ CustomerSite _Recovery_083111

    On the SharePoint Server,

    Outcome:

    Progress: Import completed.

    Finish Time: 8/31/2011 3:20:44 PM.

    Duration: 00:04:56

    Total Objects: 2002

    Finished with 0 warnings.

    So the process copied the document library into the new website (with 2002 documents) and allowed me to browse to the previous version of the Excel spreadsheet, download it, and email it to the user. Yes, I could have restored the doc library over the top of the production site, but again, that could have disrupted others.

    All this could have been prevented by turning on versioning in the document library. It’s off by default because each version snapshot takes up space and in a large library this could grow pretty significantly. You can keep it under control by specifying how many versions to retain (suggestion: 3 major versions).

    Still, this process is not very elegant. In extreme cases like this, you have to touch SQL Server, Central Admin, and PowerShell just to get a document back. What would make it elegant? A third party backup solution.

    This is what I’ve been telling people for years, because the average customer is not going to want to go through that just to restore a document. Add a BackupExec solution, though, where the agent allows the customer to browse to the version of the document they want, and restore it in place, with no fuss… this is the expected ease of use.

Reference: http://www.akspug.org/Blog/Post/40/How-to-Recover-A-Single-Document-In-SharePoint

Posted in Uncategorized, SharePoint 2010 | Leave a comment

Create a cross-site lookup field using PowerShell

Sometimes you need to create a lookup field to look up a list in another site (not the parent site).

This is how  you can do it using PowerShell:

On SharePoint server, run PowerShell as admin:


Add-PsSnapin Microsoft.SharePoint.PowerShell
$targetWeb = Get-SPWeb http://xxxxxx/Subsite1
$sourceWeb = Get-SPWeb http://xxxxxx/Subsite2
$targetList = $targetWeb.Lists.item("The target list name")
$sourceList = $sourceWeb.Lists.item("The source list name")
$NameTheLookupFieldToBeCreated = "Name of the lookup field to be created"
$ColumnInSourceList = "Name of the column in the source list"
### No need to change after this line ###
$targetList.Fields.AddLookup($NameTheLookupFieldToBeCreated, $sourceList.id, "false")
$LookupField = $targetList.Fields[$NameTheLookupFieldToBeCreated]
$LookupField.LookupWebId = $sourceList.ParentWeb.ID
$LookupField.LookupField = $sourceList.Fields[$ColumnInSourceList].InternalName
$LookupField.Update();

Posted in PowerShell, SharePoint 2010 | Leave a comment

Enable Debugging and set custom errors off in SharePoint

The original post is here:

https://blogs.msdn.microsoft.com/voyage/2014/09/02/enable-debugging-and-set-custom-errors-off-in-sharepoint/

Thanks Deepa Lakhani.

To debug a SharePoint solution you need to set following values in web.config

  • 1. Turn on the call stack (CallStack=”true”)
  • 2. Disable custom errors (<customErrors mode=”Off” />)
  • 3. Enable debugging (<compilation debug=”true”>)

Go to \\Inetpub\wwwroot\wss\VirtualDirectories\ Port_Number

This web.config defines configuration settings for a SharePoint Web application.

Now you might still get custom error message on your application page and not the real exception.

This happens because there are web.config at other places too in SharePoint.  So for configuration of layouts directory where an application page resides, you need to change the web.config at following location too.

%ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\TEMPLATE\LAYOUTS — The web.config file that defines configuration settings for the /_layouts virtual directory

Additonal Notes from msdn.

Web.config files are contained in the following folders within the file system:

  • \\Inetpub\wwwroot\wss\VirtualDirectories\ Port_Number — The web.config file that defines configuration settings for a SharePoint content Web application.
  • \\Inetpub\wwwroot\wss\VirtualDirectories\ Port_Number_of_Central_Administration — The web.config file that defines configuration settings for the SharePoint Central Administration application.
  • %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\CONFIG — The web.config file and other .config files that together define configuration settings for extending other Web applications.
  • %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\ISAPI — The web.config file that defines configuration settings for the /_vti_bin virtual directory.
  • %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\TEMPLATE\LAYOUTS — The web.config file that defines configuration settings for the /_layouts virtual directory
Posted in Uncategorized | Leave a comment

Pass query string to an InfoPath form

There is a infoPath form on a page (URL: “http://www.yoursharepoint.com/xxxx/xxxx.aspx?viewing=1&#8221;). We want to pass the value of “viewing” to the infoPath form.

  1. Create a new column “viewing” in the list;
  2. make sure the column is in the infoPath form (to accept the passed in value): PassQueryStringToInfoPath5
  3. Edit the SharePoint page, add a webpart “Query String (URL) Filter” to the page:PassQueryStringToInfoPath1
  4. Click “Open the tool pane”:PassQueryStringToInfoPath2
  5. Enter “viewing” into the Name box:PassQueryStringToInfoPath3
  6. Configure the connection: Send filter values to >> InfoPaht Form Web Part:PassQueryStringToInfoPath4
  7. Select “Viewing” in the next window.

 

 

 

Posted in InfoPath 2010, SharePoint 2010, Uncategorized | Leave a comment

Default Server Ribbon Customization Locations

Reference: https://msdn.microsoft.com/en-us/library/office/ee537543%28v=office.14%29.aspx

SharePoint 2010

Last modified: April 05, 2011

Applies to: SharePoint Foundation 2010

The Server ribbon in Microsoft SharePoint Foundation supports customization of the default tabs, groups, and controls. In order to customize these objects, you need the specific identifier (ID) for the object you plan to customize. The IDs are found in the CMDUI.xml file that is stored in the %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\GLOBAL\XML directory on the front-end Web server.

The following sections contain the default tabs, groups, and controls in the ribbon.

Ribbon.BDCAdmin tab

Ribbon.BDCAdmin.ApplicationModelManagement group

Control ID
Ribbon.BDCAdmin.ApplicationManagement.Import
Ribbon.BDCAdmin.ApplicationManagement.DeleteModel
Ribbon.BDCAdmin.ApplicationManagement.ExportModel

Ribbon.BDCAdmin.PermissionManagement group

Control ID
Ribbon.BDCAdmin.PermissionManagement.SetPermissions
Ribbon.BDCAdmin.PermissionManagement.AssignAdmins

Ribbon.BDCAdmin.ApplicationManagement group

Control ID
Ribbon.BDCAdmin.ApplicationManagement.LobSystemSettings
Ribbon.BDCAdmin.ApplicationManagement.DeleteLobSystem

Ribbon.BDCAdmin.ActionManagement group

Control ID
Ribbon.BDCAdmin.ActionManagement.Add
Ribbon.BDCAdmin.ActionManagement.Edit
Ribbon.BDCAdmin.ActionManagement.Delete

Ribbon.BDCAdmin.ViewManagement group

Control ID
Ribbon.BDCAdmin.ViewManagement.Views

Ribbon.DocLibListForm.Edit tab

Ribbon.DocLibListForm.Edit.Commit group

Control ID
Ribbon.DocLibListForm.Edit.Commit.Publish
Ribbon.DocLibListForm.Edit.Commit.CheckIn
Ribbon.DocLibListForm.Edit.Commit.Cancel

Ribbon.DocLibListForm.Edit.Clipboard group

Control ID
Ribbon.DocLibListForm.Edit.Clipboard.Paste
Ribbon.DocLibListForm.Edit.Clipboard.Cut
Ribbon.DocLibListForm.Edit.Clipboard.Copy

Ribbon.DocLibListForm.Edit.Actions group

Control ID
Ribbon.DocLibListForm.Edit.Actions.DeleteItem
Ribbon.DocLibListForm.Edit.Actions.CheckIn
Ribbon.DocLibListForm.Edit.Actions.CheckOut
Ribbon.DocLibListForm.Edit.Actions.VersionHistory
Ribbon.DocLibListForm.Edit.Actions.ExportWebPart
Ribbon.DocLibListForm.Edit.Actions.ViewWebPartXml
Ribbon.DocLibListForm.Edit.Actions.ManagePermissions

Ribbon.ListForm.Display tab

Ribbon.ListForm.Display.Manage group

Control ID
Ribbon.ListForm.Display.Manage.EditItem
Ribbon.ListForm.Display.Manage.EditSeries
Ribbon.ListForm.Display.Manage.VersionHistory
Ribbon.ListForm.Display.Manage.ManagePermissions
Ribbon.ListForm.Display.Manage.DeleteItem

Ribbon.ListForm.Display.Actions group

Control ID
Ribbon.ListForm.Display.Manage.CheckIn
Ribbon.ListForm.Display.Manage.CheckOut
Ribbon.ListForm.Display.Manage.Alert
Ribbon.ListForm.Display.Manage.ApproveReject
Ribbon.ListForm.Display.Manage.ManageCopies
Ribbon.ListForm.Display.Manage.Workflows
Ribbon.ListForm.Display.Manage.EnterFolder
Ribbon.ListForm.Display.Manage.ClaimReleaseTask
Ribbon.ListForm.Display.Manage.DistributionListsApproval
Ribbon.ListForm.Display.Manage.DeleteItemVersion
Ribbon.ListForm.Display.Manage.RestoreItemVersion

Ribbon.ListForm.Display.HealthActions group

Control ID
Ribbon.ListForm.Display.HealthActions.HealthRuleRunNow
Ribbon.ListForm.Display.HealthActions.HealthReportRunNow
Ribbon.ListForm.Display.HealthActions.HealthReportRepair

Ribbon.ListForm.Display.Solution group

Control ID
Ribbon.ListForm.Display.Solution.Activate
Ribbon.ListForm.Display.Solution.Deactivate
Ribbon.ListForm.Display.Solution.Upgrade

Ribbon.ListForm.Edit tab

Ribbon.ListForm.Edit.Commit group

Control ID
Ribbon.ListForm.Edit.Commit.Publish
Ribbon.ListForm.Edit.Commit.Cancel

Ribbon.ListForm.Edit.Clipboard group

Control ID
Ribbon.ListForm.Edit.Clipboard.Paste
Ribbon.ListForm.Edit.Clipboard.Cut
Ribbon.ListForm.Edit.Clipboard.Copy

Ribbon.ListForm.Edit.Actions group

Control ID
Ribbon.ListForm.Edit.Actions.DeleteItem
Ribbon.ListForm.Edit.Actions.EditSeries
Ribbon.ListForm.Edit.Actions.ClaimReleaseTask
Ribbon.ListForm.Edit.Actions.AttachFile
Ribbon.ListForm.Edit.Actions.DistributionListsApproval

Ribbon.PostListForm.Edit tab

Ribbon.PostListForm.Edit.Commit group

Control ID
Ribbon.PostListForm.Edit.Commit.Publish
Ribbon.PostListForm.Edit.Commit.SaveAsDraft
Ribbon.PostListForm.Edit.Commit.Cancel

Ribbon.PostListForm.Edit.Clipboard group

Control ID
Ribbon.PostListForm.Edit.Clipboard.Paste
Ribbon.PostListForm.Edit.Clipboard.Cut
Ribbon.PostListForm.Edit.Clipboard.Copy

Ribbon.PostListForm.Edit.Actions group

Control ID
Ribbon.PostListForm.Edit.Actions.DeleteItem
Ribbon.PostListForm.Edit.Actions.EditSeries

Ribbon.SvcApp tab

Ribbon.SvcApp.Create group

Control ID
Ribbon.SvcApp.Create.New
Ribbon.SvcApp.Create.Connect

Ribbon.SvcApp.Operations group

Control ID
Ribbon.SvcApp.Operations.Delete
Ribbon.SvcApp.Operations.Manage
Ribbon.SvcApp.Operations.Administrators
Ribbon.SvcApp.Operations.Properties

Ribbon.SvcApp.Sharing group

Control ID
Ribbon.SvcApp.Sharing.Publish
Ribbon.SvcApp.Sharing.Permissions

Ribbon.Solution tab

Ribbon.Solution.New group

Control ID
Ribbon.Solution.All.Upload

Ribbon.Solution.All group

Control ID
Ribbon.Solution.All.Delete
Ribbon.Solution.All.Activate
Ribbon.Solution.All.Deactivate
Ribbon.Solution.All.Upgrade

Ribbon.UsageReport tab

Ribbon.UsageReport.DateRange group

Control ID
Ribbon.UsageReport.DateRange.Day
Ribbon.UsageReport.DateRange.Month
Ribbon.UsageReport.DateRange.Year

Ribbon.WikiPageTab tab

Ribbon.WikiPageTab.EditAndCheckout group

Control ID
Ribbon.WikiPageTab.EditAndCheckout.SaveEdit
Ribbon.WikiPageTab.EditAndCheckout.Checkout

Ribbon.WikiPageTab.Manage group

Control ID
Ribbon.WikiPageTab.Manage.PageProperties
Ribbon.WikiPageTab.Manage.RenamePage
Ribbon.WikiPageTab.Manage.VersionDiff
Ribbon.WikiPageTab.Manage.Permissions
Ribbon.WikiPageTab.Manage.DeletePage

Ribbon.WikiPageTab.Share group

Control ID
Ribbon.WikiPageTab.Share.EmailPageLink
Ribbon.WikiPageTab.Share.AlertMe

Ribbon.WikiPageTab.PageActions group

Control ID
Ribbon.WikiPageTab.PageActions.SetHomePage
Ribbon.WikiPageTab.PageActions.IncomingLinks

Ribbon.WikiPageTab.LibrarySettings group

Control ID
Ribbon.WikiPageTab.LibrarySettings.LibSettings
Ribbon.WikiPageTab.LibrarySettings.LibraryPermissions
Ribbon.WikiPageTab.LibrarySettings.ViewAllPages

Ribbon.PublishTab tab

Ribbon.PublishTab.Publishing group

Control ID
Ribbon.PublishTab.Publishing.Publish
Ribbon.PublishTab.Publishing.Approve
Ribbon.PublishTab.Publishing.Reject

Ribbon.PublishTab.Workflow group

Control ID
Ribbon.PublishTab.Workflow.ManageWorkflow

Ribbon.WebPartPage tab

Ribbon.WebPartPage.Edit group

Control ID
Ribbon.WebPartPage.Edit.Edit

Ribbon.WebPartPage.Manage group

Control ID
Ribbon.WebPartPage.Manage.EditProperties
Ribbon.WebPartPage.Manage.Versions
Ribbon.WebPartPage.Manage.Permissions
Ribbon.WebPartPage.Manage.Delete

Ribbon.WebPartPage.Share group

Control ID
Ribbon.WebPartPage.Share.EmailPageLink
Ribbon.WebPartPage.Share.AlertMe

Ribbon.WebPartPage.Approval group

Control ID
Ribbon.WebPartPage.Approval.Approve
Ribbon.WebPartPage.Approval.Reject

Ribbon.WebPartPage.Workflow group

Control ID
Ribbon.WebPartPage.Workflow.ManageWorkflow

Ribbon.WebPartPage.Actions group

Control ID
Ribbon.WebPartPage.Actions.EditMobilePage
Ribbon.WebPartPage.Actions.MakeHomePage
Ribbon.WebPartPage.Actions.EditTitleBar

Ribbon.WebApp tab

Ribbon.WebApp.Contribute group

Control ID
Ribbon.WebApp.Contribute.New
Ribbon.WebApp.Contribute.Extend
Ribbon.WebApp.Contribute.Delete

Ribbon.WebApp.Manage group

Control ID
Ribbon.WebApp.Manage.Settings
Ribbon.WebApp.Manage.Features
Ribbon.WebApp.Manage.Paths
Ribbon.WebApp.Manage.Connections

Ribbon.WebApp.Security group

Control ID
Ribbon.WebApp.Security.Controls.AuthProviders
Ribbon.WebApp.Security.Controls.SelfSite
Ribbon.WebApp.Security.Controls.BlockedFiles
Ribbon.WebApp.Security.Controls.UserPermissions
Ribbon.WebApp.Security.Controls.WebPart

Ribbon.WebApp.Policy group

Control ID
Ribbon.WebApp.Policy.Controls.GeneralPolicy
Ribbon.WebApp.Policy.Controls.Anonymous
Ribbon.WebApp.Policy.Controls.PermissionPolicy

Ribbon.SiteCollections tab

Ribbon.SiteCollections.Contribute group

Control ID
Ribbon.SiteCollections.Contribute.CreateSite
Ribbon.SiteCollections.Contribute.Delete

Ribbon.SiteCollections.Review group

Control ID
Ribbon.SiteCollections.Review.ViewProperties

Ribbon.SiteCollections.Manage group

Control ID
Ribbon.SiteCollections.Manage.Owners
Ribbon.SiteCollections.Manage.DiskQuota

Ribbon.ManageTrust tab

Ribbon.ManageTrust.Operations group

Control ID
Ribbon.ManageTrust.Create
Ribbon.ManageTrust.Operations.Edit
Ribbon.ManageTrust.Operations.Delete

Ribbon.EditingTools.CPEditTab tab

Ribbon.EditingTools.CPEditTab.EditAndCheckout group

Control ID
Ribbon.EditingTools.CPEditTab.EditAndCheckout.SaveEdit
Ribbon.EditingTools.CPEditTab.EditAndCheckout.Checkout

Ribbon.EditingTools.CPEditTab.Clipboard group

Control ID
Ribbon.EditingTools.CPEditTab.Clipboard.Paste
Ribbon.EditingTools.CPEditTab.Clipboard.Cut
Ribbon.EditingTools.CPEditTab.Clipboard.Copy
Ribbon.EditingTools.CPEditTab.Clipboard.Undo

Ribbon.EditingTools.CPEditTab.Font group

Control ID
Ribbon.EditingTools.CPEditTab.Font.Fonts
Ribbon.EditingTools.CPEditTab.Font.FontSize
Ribbon.EditingTools.CPEditTab.Font.ClearFormat
Ribbon.EditingTools.CPEditTab.Font.Bold
Ribbon.EditingTools.CPEditTab.Font.Italics
Ribbon.EditingTools.CPEditTab.Font.Underline
Ribbon.EditingTools.CPEditTab.Font.Strikethrough
Ribbon.EditingTools.CPEditTab.Font.Subscript
Ribbon.EditingTools.CPEditTab.Font.Superscript
Ribbon.EditingTools.CPEditTab.Font.FontBackgroundColor
Ribbon.EditingTools.CPEditTab.Font.FontColor

Ribbon.EditingTools.CPEditTab.Paragraph group

Control ID
Ribbon.EditingTools.CPEditTab.Paragraph.Bullets
Ribbon.EditingTools.CPEditTab.Paragraph.Numbering
Ribbon.EditingTools.CPEditTab.Paragraph.Outdent
Ribbon.EditingTools.CPEditTab.Paragraph.Indent
Ribbon.EditingTools.CPEditTab.Paragraph.LTR
Ribbon.EditingTools.CPEditTab.Paragraph.RTL
Ribbon.EditingTools.CPEditTab.Paragraph.AlignLeft
Ribbon.EditingTools.CPEditTab.Paragraph.AlignCenter
Ribbon.EditingTools.CPEditTab.Paragraph.AlignRight
Ribbon.EditingTools.CPEditTab.Paragraph.AlignJustify

Ribbon.EditingTools.CPEditTab.Styles group

Control ID
Ribbon.EditingTools.CPEditTab.Styles.Styles

Ribbon.EditingTools.CPEditTab.Layout group

Control ID
Ribbon.EditingTools.CPEditTab.Layout.PageLayout

Ribbon.EditingTools.CPEditTab.Markup group

Control ID
Ribbon.EditingTools.CPEditTab.Markup.ElementWithStyle
Ribbon.EditingTools.CPEditTab.Markup.LanguagesLabel
Ribbon.EditingTools.CPEditTab.Markup.SelectLabel
Ribbon.EditingTools.CPEditTab.Markup.HtmlLabel
Ribbon.EditingTools.CPEditTab.Markup.Languages
Ribbon.EditingTools.CPEditTab.Markup.Select
Ribbon.EditingTools.CPEditTab.Markup.Html

Ribbon.EditingTools.CPInsert tab

Ribbon.EditingTools.CPInsert.Tables group

Control ID
Ribbon.EditingTools.CPInsert.Tables.Table

Ribbon.EditingTools.CPInsert.Media group

Control ID
Ribbon.EditingTools.CPInsert.Media.Image

Ribbon.EditingTools.CPInsert.Links group

Control ID
Ribbon.EditingTools.CPInsert.Links.Link
Ribbon.EditingTools.CPInsert.Links.UploadFile

Ribbon.EditingTools.CPInsert.WebParts group

Control ID
Ribbon.EditingTools.CPInsert.WebParts.WebPart
Ribbon.EditingTools.CPInsert.WebParts.ExistingList
Ribbon.EditingTools.CPInsert.WebParts.InsertNewList

Ribbon.Image.Image tab

Ribbon.Image.Image.Edit group

Control ID
Ribbon.Image.Image.Edit.Edit

Ribbon.Image.Image.Properties group

Control ID
Ribbon.Image.Image.Properties.URLLabel
Ribbon.Image.Image.Properties.URL
Ribbon.Image.Image.Properties.AltTextLabel
Ribbon.Image.Image.Properties.AltText

Ribbon.Image.Image.Styles group

Control ID
Ribbon.Image.Image.Styles.ImageStyles

Ribbon.Image.Image.Arrange group

Control ID
Ribbon.Image.Image.Arrange.ImageArrange

Ribbon.Image.Image.Size group

Control ID
Ribbon.Image.Image.Size.HorizontalSizeLabel
Ribbon.Image.Image.Size.HorizontalSize
Ribbon.Image.Image.Size.VertSizeLabel
Ribbon.Image.Image.Size.VerticalSize
Ribbon.Image.Image.Size.LockAspect

Ribbon.Document tab

Ribbon.Documents.New group

Control ID
Ribbon.Documents.New.NewDocument
Ribbon.Documents.New.AddDocument

Ribbon.Documents.EditCheckout group

Control ID
Ribbon.Documents.EditCheckout.EditDocument
Ribbon.Documents.EditCheckout.CheckOut
Ribbon.Documents.EditCheckout.CheckIn
Ribbon.Documents.EditCheckout.DiscardCheckOut

Ribbon.Documents.Manage group

Control ID
Ribbon.Documents.Manage.ViewProperties
Ribbon.Documents.Manage.EditProperties
Ribbon.Documents.Manage.ViewVersions
Ribbon.Documents.Manage.ManagePermissions
Ribbon.Documents.Manage.Delete

Ribbon.Documents.Share group

Control ID
Ribbon.Documents.Share.EmailItemLink
Ribbon.Documents.Share.AlertMe

Ribbon.Documents.Copies group

Control ID
Ribbon.Documents.Copies.Download
Ribbon.Documents.Copies.SendTo
Ribbon.Documents.Copies.ManageCopies
Ribbon.Documents.Copies.GoToSourceItem

Ribbon.Documents.Workflow group

Control ID
Ribbon.Documents.Workflow.ViewWorkflows
Ribbon.Documents.Workflow.Publish
Ribbon.Documents.Workflow.Unpublish
Ribbon.Documents.Workflow.Moderate
Ribbon.Documents.Workflow.CancelApproval

Ribbon.Documents.FormActions group

Control ID
Ribbon.Documents.FormActions.RepairItems
Ribbon.Documents.FormActions.RepairAllItems
Ribbon.Documents.FormActions.MergeDocuments

Ribbon.Library tab

Ribbon.Library.ViewFormat group

Control ID
Ribbon.Library.ViewFormat.Standard
Ribbon.Library.ViewFormat.Datasheet

Ribbon.Library.Datasheet group

Control ID
Ribbon.Library.Datasheet.NewRow
Ribbon.Library.Datasheet.ShowTaskPane
Ribbon.Library.Datasheet.ShowTotals
Ribbon.Library.Datasheet.RefreshData

Ribbon.Library.CustomViews group

Control ID
Ribbon.Library.Actions.AllMeetings
Ribbon.Library.CustomViews.CreateView
Ribbon.Library.CustomViews.ModifyView
Ribbon.Library.CustomViews.CreateColumn
Ribbon.Library.CustomViews.NavigateUp
Ribbon.Library.CustomViews.CurrentView
Ribbon.Library.CustomViews.DisplayView
Ribbon.Library.CustomViews.PreviousPage
Ribbon.Library.CustomViews.CurrentPage
Ribbon.Library.CustomViews.NextPage

Ribbon.Library.Share group

Control ID
Ribbon.Library.Share.EmailLibraryLink
Ribbon.Library.Share.AlertMe
Ribbon.Library.Share.ViewRSSFeed

Ribbon.Library.Actions group

Control ID
Ribbon.Library.Actions.TakeOfflineToClient
Ribbon.Library.Actions.ConnectToClient
Ribbon.Library.Actions.ExportToSpreadsheet
Ribbon.Library.Actions.OpenWithExplorer

Ribbon.Library.CustomizeLibrary group

Control ID
Ribbon.Library.CustomizeLibrary.AddButton
Ribbon.Library.CustomizeLibrary.EditList
Ribbon.Library.CustomizeLibrary.EditDefaultForms

Ribbon.Library.Settings group

Control ID
Ribbon.Library.Settings.DocumentLibrarySettings
Ribbon.Library.Settings.LibraryPermissions
Ribbon.Library.Settings.ManageWorkflows

Ribbon.ListItem tab

Ribbon.ListItem.New group

Control ID
Ribbon.ListItem.New.NewListItem
Ribbon.ListItem.New.NewFolder

Ribbon.ListItem.Manage group

Control ID
Ribbon.ListItem.Manage.ViewProperties
Ribbon.ListItem.Manage.EditProperties
Ribbon.ListItem.Manage.ViewVersions
Ribbon.ListItem.Manage.ManagePermissions
Ribbon.ListItem.Manage.Delete

Ribbon.ListItem.Actions group

Control ID
Ribbon.ListItem.Actions.AttachFile
Ribbon.ListItem.Actions.ChangeItemOrder

Ribbon.ListItem.Share group

Control ID
Ribbon.ListItem.Share.AlertMe

Ribbon.ListItem.Workflow group

Control ID
Ribbon.ListItem.Workflow.ViewWorkflows
Ribbon.ListItem.Workflow.Moderate

Ribbon.List tab

Ribbon.List.ViewFormat group

Control ID
Ribbon.List.ViewFormat.Standard
Ribbon.List.ViewFormat.Datasheet

Ribbon.List.Datasheet group

Control ID
Ribbon.List.Datasheet.NewRow
Ribbon.List.Datasheet.ShowTaskPane
Ribbon.List.Datasheet.ShowTotals
Ribbon.List.Datasheet.RefreshData

Ribbon.List.GanttView group

Control ID
Ribbon.List.GanttView.ZoomIn
Ribbon.List.GanttView.ZoomOut
Ribbon.List.GanttView.ScrollToTask

Ribbon.List.CustomViews group

Control ID
Ribbon.List.Actions.AllMeetings
Ribbon.List.CustomViews.CreateView
Ribbon.List.CustomViews.ModifyView
Ribbon.List.CustomViews.CreateColumn
Ribbon.List.CustomViews.NavigateUp
Ribbon.List.CustomViews.CurrentView
Ribbon.List.CustomViews.DisplayView
Ribbon.List.CustomViews.PreviousPage
Ribbon.List.CustomViews.CurrentPage
Ribbon.List.CustomViews.NextPage

Ribbon.List.Share group

Control ID
Ribbon.List.Share.EmailLibraryLink
Ribbon.List.Share.AlertMe
Ribbon.List.Share.ViewRSSFeed

Ribbon.List.Actions group

Control ID
Ribbon.List.Actions.TakeOfflineToClient
Ribbon.List.Actions.ConnectToClient
Ribbon.List.Actions.ExportToSpreadsheet
Ribbon.List.Actions.CreateVisioDiagram
Ribbon.List.Actions.OpenWithAccess
Ribbon.List.Actions.ExportToProject

Ribbon.List.CustomizeList group

Control ID
Ribbon.List.CustomizeList.AddButton
Ribbon.List.CustomizeList.EditList
Ribbon.List.CustomizeList.EditDefaultForms

Ribbon.List.Settings group

Control ID
Ribbon.List.Settings.ListSettings
Ribbon.List.Settings.ListPermissions
Ribbon.List.Settings.ManageWorkflows

Ribbon.Link.Link tab

Ribbon.Link.Link.Link group

Control ID
Ribbon.Link.Link.Link.RemoveLink

Ribbon.Link.Link.Properties group

Control ID
Ribbon.Link.Link.Properties.LinkAddressLabel
Ribbon.Link.Link.Properties.LinkAddress
Ribbon.Link.Link.Properties.LinkTooltipLabel
Ribbon.Link.Link.Properties.LinkTooltip

Ribbon.Link.Link.Behavior group

Control ID
Ribbon.Link.Link.Behavior.PopUp
Ribbon.Link.Link.Behavior.DisplayIcon

Ribbon.Table.Layout tab

Ribbon.Table.Layout.Table group

Control ID
Ribbon.Table.Layout.Table.TableGridLines

Ribbon.Table.Layout.Cells group

Control ID
Ribbon.Table.Layout.Cells.MergeCells
Ribbon.Table.Layout.Cells.Split

Ribbon.Table.Layout.RowsCols group

Control ID
Ribbon.Table.Layout.RowsCols.InsertAbove
Ribbon.Table.Layout.RowsCols.InsertBelow
Ribbon.Table.Layout.RowsCols.InsertLeft
Ribbon.Table.Layout.RowsCols.InsertRight
Ribbon.Table.Layout.RowsCols.Delete

Ribbon.Table.Layout.Properties group

Control ID
Ribbon.Table.Layout.Properties.TableWidthLabel
Ribbon.Table.Layout.Properties.TableHeightLabel
Ribbon.Table.Layout.Properties.TableWidth
Ribbon.Table.Layout.Properties.TableHeight
Ribbon.Table.Layout.Properties.ColumnWidthLabel
Ribbon.Table.Layout.Properties.RowHeightLabel
Ribbon.Table.Layout.Properties.ColumnWidth
Ribbon.Table.Layout.Properties.RowHeight

Ribbon.Table.Layout.Summary group

Control ID
Ribbon.Table.Layout.Summary.SummaryLabel
Ribbon.Table.Layout.Summary.Summary

Ribbon.Table.Design tab

Ribbon.Table.Design.StyleOptions group

Control ID
Ribbon.Table.Design.StyleOptions.TableHead
Ribbon.Table.Design.StyleOptions.TableFirstCol
Ribbon.Table.Design.StyleOptions.TableLastRow
Ribbon.Table.Design.StyleOptions.TableLastCol

Ribbon.Table.Design.Style group

Control ID
Ribbon.Table.Design.Style.TableStyles

Ribbon.WebPartInsert.Tab tab

Ribbon.WebPartInsert.Text group

Control ID
Ribbon.WebPartInsert.Text.Text

Ribbon.WebPartInsert.Media group

Control ID
Ribbon.WebPartInsert.Media.Image

Ribbon.WebPartInsert.InsertRelatedDataToListForm group

Control ID
Ribbon.WebPartInsert.InsertRelatedDataToListForm.RelatedWebPart

Ribbon.WebPartInsert.WebParts group

Control ID
Ribbon.WebPartInsert.WebParts.WebPart
Ribbon.WebPartInsert.WebParts.ExistingList

Ribbon.WebPartOption tab

Ribbon.WebPartOption.Properties group

Control ID
Ribbon.WebPartOption.Commands.Modify

Ribbon.WebPartOption.InsertRelatedDataToListView group

Control ID
Ribbon.WebPartOption.InsertRelatedDataToListView.RelatedWebPart

Ribbon.WebPartOption.Commands group

Control ID
Ribbon.WebPartOption.Commands.Minimize
Ribbon.WebPartOption.Commands.Restore
Ribbon.WebPartOption.Commands.Delete

Ribbon.Calendar.Events tab

Ribbon.Calendar.Events.New group

Control ID
Ribbon.Calendar.Events.New.NewListItem

Ribbon.Calendar.Events.Manage group

Control ID
Ribbon.Calendar.Events.Manage.ViewProperties
Ribbon.Calendar.Events.Manage.EditProperties
Ribbon.Calendar.Events.Manage.ViewVersions
Ribbon.Calendar.Events.Manage.ManagePermissions
Ribbon.Calendar.Events.Manage.Delete

Ribbon.Calendar.Events.Share group

Control ID
Ribbon.Calendar.Events.Share.AlertMe

Ribbon.Calendar.Events.Workflow group

Control ID
Ribbon.Calendar.Events.Workflow.ViewWorkflows
Ribbon.Calendar.Events.Workflow.Moderate

Ribbon.Calendar.Calendar tab

Ribbon.Calendar.Calendar.Selector group

Control ID
Ribbon.Calendar.Calendar.Selector.People
Ribbon.Calendar.Calendar.Selector.Resource

Ribbon.Calendar.Calendar.Scope group

Control ID
Ribbon.Calendar.Calendar.Scope.DayGroup
Ribbon.Calendar.Calendar.Scope.WeekGroup
Ribbon.Calendar.Calendar.Scope.Day
Ribbon.Calendar.Calendar.Scope.Week
Ribbon.Calendar.Calendar.Scope.Month

Ribbon.Calendar.Calendar.Expander group

Control ID
Ribbon.Calendar.Calendar.Expander.ExpandAll
Ribbon.Calendar.Calendar.Expander.CollapseAll

Ribbon.Calendar.Calendar.CustomViews group

Control ID
Ribbon.Calendar.Calendar.CustomViews.CreateView
Ribbon.Calendar.Calendar.CustomViews.CurrentView
Ribbon.Calendar.Calendar.CustomViews.DisplayView
Ribbon.Calendar.Calendar.CustomViews.ModifyView

Ribbon.Calendar.Calendar.Share group

Control ID
Ribbon.Calendar.Calendar.Share.EmailLibraryLink
Ribbon.Calendar.Calendar.Share.AlertMe
Ribbon.Calendar.Calendar.Share.ViewRSSFeed

Ribbon.Calendar.Calendar.Actions group

Control ID
Ribbon.Calendar.Calendar.Actions.TakeOfflineToClient
Ribbon.Calendar.Calendar.Actions.ConnectToClient
Ribbon.Calendar.Calendar.Actions.ExportToSpreadsheet
Ribbon.Calendar.Calendar.Actions.OpenWithAccess

Ribbon.Calendar.Calendar.Settings group

Control ID
Ribbon.Calendar.Calendar.Settings.ListSettings
Ribbon.Calendar.Calendar.Settings.AddCalendar
Ribbon.Calendar.Calendar.Settings.ManageWorkflows
Ribbon.Calendar.Calendar.Settings.ListPermissions
Ribbon.List.Settings.EditList

Ribbon.Permission tab

Ribbon.Permission.Parent group

Control ID
Ribbon.Permission.Parent.ManageParent
Ribbon.Permission.Parent.Inherit
Ribbon.Permission.Parent.StopInherit

Ribbon.Permission.Add group

Control ID
Ribbon.Permission.Add.AddUser
Ribbon.Permission.Add.NewGroup

Ribbon.Permission.Modify group

Control ID
Ribbon.Permission.Modify.EditUsrPerm
Ribbon.Permission.Modify.RemovePerms

Ribbon.Permission.Check group

Control ID
Ribbon.Permission.Check.CheckUsrPerm

Ribbon.Permission.Manage group

Control ID
Ribbon.Permission.Manage.AnonyAccess
Ribbon.Permission.Manage.PermLevels
Ribbon.Permission.Manage.ManagAccReq
Ribbon.Permission.Manage.SiteColAdmin
Posted in SharePoint 2010, Visual Studio 2010 | Leave a comment

SharePoint: RegistrationId List Template Type IDs

Reference: http://techtrainingnotes.blogspot.com.au/2008/01/sharepoint-registrationid-list-template.html

Below is a list of RegistrationIDs for use with API code and CustomAction Features (for user created list types) and any other list types I have found.

In this article you will find:

  • A table of all of the codes I have found.
  • A C# routine to dump the standard enumeration of SPListTemplateTypes.
  • A PowerShell script to dump the standard enumeration of SPListTemplateTypes.

For more info on CustomAction see: http://msdn.microsoft.com/en-us/library/ms460194.aspx

For a list of the CustomActions Rights values see: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx

 

The Table

“ “ = WSS 3.0, “M” = MOSS 2007 only list type, “E” = MOSS 2007 Enterprise, 2010 = 2010!

0 = list, 1 = library, (4 used for surveys only???)

Fourth column contains notes, names as displayed in SharePoint or in the SQL content database and best guesses 😉

“not in SPListTemplateType”: Most, but not all of the IDs are in an API enumeration named SPListTemplateType

-1 InvalidType (not used)
100 GenericList 0 (see note below)
Also used for “Import Spreadsheet”
Also: (and I’m sure more…)
Relationships List
Reusable Content
Quick Deploy Items
Variation Labels
Long Running Operation Status
Notification List
Reporting Metadata
Cache Profiles
Content and Structure Reports
Reporting Metadata
Suggested Content Browser Locations

From Central Admin:
Content Deployment Jobs
Content Deployment Paths

From Central Admin 2010:
Job Reports
Reporting Metadata

101 DocumentLibrary 1 all kinds of libraries:

From 2010:
cache
Customized Reports
Form Templates
Reporting Templates
Shared Documents
Site Assets
Style Library

102 Survey 4
103 Links 0
104 Announcements 0
105 Contacts 0
106 Events 0 Calendar
107 Tasks 0 Task lists in general, including “Workflow tasks”
108 DiscussionBoard 0 Example: “Team Discussion”
109 PictureLibrary 1
110 DataSources 1 (fpdatasources = FrontPage Data Sources???)
111 WebTemplateCatalog 1 “Site Template Gallery”
112 UserInformation 0 “User Information List” (all people)
113 WebPartCatalog 1 “Web Part Gallery”
114 ListTemplateCatalog 1 “List Template Gallery”
115 XMLForm 1 “Form Library” InfoPath Forms Library
116 MasterPageCatalog 1 “Master Page Gallery”
117 NoCodeWorkflows 1 “Workflows”
118 WorkflowProcess
119 WebPageLibrary 1 “Wiki Library” (also “Site Pages” in 2010)
120 CustomGrid 0 “Custom List in Datasheet View”
121 SolutionCatalog 0 2010 “Solution Gallery”
122 NoCodePublic 0 2010 No Code Public Workflows
123 ThemeCatalog 0 2010 “Theme Gallery”
124 DesignCatalog 2013
125 AppDataCatalog 2013
130 DataConnectionLibrary 1 M “Data Connection Library”
140 WorkflowHistory 0 “Workflow History”  (“Macros” in 2010’s CharitableContributions template)
150 GanttTasks 0 “Project Tasks” task list
151 HelpLibrary Product Help (Central Admin only?)
160 AccessRequest 0 2013
171 TasksWithTimelineAndHierarchy 0 2013
175 MaintenanceLogs 2013
200 Meetings 0 Meeting templates – “Meeting Series”
201 Agenda 0 Meeting templates – “Agenda”
202 MeetingUser 0 Meeting templates – “Attendees”
204 Decision Meeting templates
207 MeetingObjective 0 Meeting templates – “Objectives”
210 TextBox 0 Meeting templates – “Directions” (“Use this list to insert custom text into your meeting.”)
211 ThingsToBring 0 Meeting templates – “Things To Bring”
212 HomePageLibrary 1 Meeting templates – “Workspace Pages”
300 Sites 0 M Sites list in Publishing templates (not in SPListTemplateType)
301 Posts 0 Used in blogs (also appears to be used for Search tabs)
302 Comments 0 Used in blogs
303 Categories 0 Used in blogs
398 0 2010 Access Services Application Log
399 0 2010 Access Services System Objects
402 Facility 0 2010 Resources
“Use the Resources list to document shared assets, such as cameras and vehicles. Users can reserve and track listed resources in Group Calendar.” (used in the new Group Work Site template)
403 Whereabouts 0 2010 Whereabouts
“Use this list to quickly and easily track the location of individuals throughout the day.” (used in the new Group Work Site template)
404 CallTrack 0 2010 Phone Call Memo
(used in the new Group Work Site template)
405 Circulation 0 2010 Circulations
“Use this list to inform team members and request confirmation stamps.”  (used in the new Group Work Site template)
420 Timecard 0 2010
421 Holidays 0 2010
432 0 E “Sample KPIs” (not in SPListTemplateType)
433 1 E “Reports Library”(not in SPListTemplateType)
434 1 E “Reference Library”(not in SPListTemplateType)
499 IMEDic 0 2010 IME Dictionary (Input Method Editor: http://office.microsoft.com/en-us/powerpoint/HP030900551033.aspx)
544 2013 Micro Feed / Published Feed (also 2010?)
600 ExternalList 0 2010 External List
700 MySiteDocumentLibrary 2013
850 Pages 1 M Used with publishing templates
(thanks to Anders Jacobsen for this one) (not in SPListTemplateType)
851 1 M, 2010 “Images”, “Site Collection Images”  “This system library was created by the Publishing feature to store images that are used on pages in this site.” (not in SPListTemplateType)  Also: “Asset Libary” in 2010
1100 IssueTracking 0 “Issue Tracking” task list
1200 AdminTasks 0 used in Central Administration
1220 HealthRules 0 2010 used in Central Administration
1221 HealthReports 0 2010 used in Central Administration
1230 DeveloperSiteDraftApps 1 2013 Draft Apps library in Developer Site
1300 Translation Management Library 1 M (thanks to Dennis for this one) (not in SPListTemplateType)
1301 Languages & Translations 0 M “Translators” Created with a 1300
(thanks to Dennis for this one) (not in SPListTemplateType)
2100 1 M PowerPoint Slide Library (not in SPListTemplateType)
10102 Converted Forms 1 “List of user browser-enabled form templates on this site collection” (not in SPListTemplateType)

 

Note: 100 is used for any custom listed create from Site Actions -> Create -> Custom List. If you created and deployed the custom lists using a SharePoint Feature then the RegistrationID is the same as the list “Type” ID you used in your list’s feature manifest file. Here is some more info: http://sharepointinsight.com/blog/Lists/Posts/Post.aspx?ID=33 Please let me know if there are more IDs for this list? For example: 203?

 

Want to see the IDs used in your site collection?

Note that direct queries of the SharePoint content databases is never a good practice and my invalidate your support agreements! Try the following only on a test or dev server.

USE WSS_Content (database for your application)
SELECT tp_Title, tp_BaseType, tp_ServerTemplate, tp_Description
FROM AllLists
ORDER BY tp_ServerTemplate, tp_Title

 

Want to see all of the IDs listed in the API enumerations using C#?

Create a Console Application and set a reference to Microsoft.SharePoint for your version (12, 14, etc).

using System;
using Microsoft.SharePoint;

namespace ConsoleApplication1
{
  class Program
  {
    static void Main(string[] args)
    {
      int i = 0;
      foreach (string enumName in Enum.GetNames(typeof(SPListTemplateType)))
      {
        i++;
        Console.Write(i);
        Console.Write(String.Format(": {0,-23} ", enumName));
        Console.Write((int)(Enum.Parse(typeof(SPListTemplateType), enumName)));
        Console.WriteLine();
      }
      Console.ReadLine();

    }
  }
}

 

Want to see all of the IDs listed in the API enumerations using PowerShell?

PS C:\> $SPtt = [Microsoft.SharePoint.SPListTemplateType]
PS C:\> [System.Enum]::GetNames($SPtt) |  select {[int][System.Enum]::Parse($SPtt, $_)}, {$_} 

.

Posted in SharePoint 2010, Visual Studio 2010 | Leave a comment

Create Custom Ribbon Actions in Visual Studio

This example creates an “Email to Someone” custom action in the Ribbon of lists and libraries.

emailtosomeone

  1. Create a new SharePoint empty project (Sandbox solution);
  2. Add a new item >> Empty Element;
  3. Sample code for Elements.xml
    <?xml version=”1.0″ encoding=”utf-8″ ?>
    <Elements xmlns=”http://schemas.microsoft.com/sharepoint/”&gt;
    <CustomAction
    Id=”CAAlertRibbonButton”
    RegistrationId=”100″
    RegistrationType=”List”
    Location=”CommandUI.Ribbon.ListView”
    Sequence=”5″
    Title=”Alert Ribbon Button”>
    <CommandUIExtension>
    <CommandUIDefinitions>
    <CommandUIDefinition
    Location=”Ribbon.ListItem.Groups._children”>
    <Group
    Id=”MiTek.ListItem”
    Sequence=”80″
    Description=”MiTek group”
    Title=”MiTek Custom”
    Template=”Ribbon.Templates.Flexible2″>
    <Controls Id=”MiTek.SharePoint.Administration.Application.Group.Controls”>
    <Button
    Id=”MiTek.Ribbon.ListItem.EmailSomeone”
    Command=”CMDRibbonButton”
    Image32by32=”/Style%20Library/Custom%20Images/emailIcon.png”
    LabelText=”Email To Someone”
    TemplateAlias=”o2″
    Sequence=”20″ />
    </Controls>
    </Group>
    </CommandUIDefinition>
    <CommandUIDefinition
    Location=”Ribbon.ListItem.Scaling._children”>
    <MaxSize
    Id=”MiTek.Ribbon.ListItem.MaxSize”
    Sequence=”15″
    GroupId=”MiTek.ListItem”
    Size=”LargeLarge” />
    </CommandUIDefinition>
    <!– Put in the Actions Group –>
    <!–CommandUIDefinition Location=”Ribbon.ListItem.Actions.Controls._children”>
    <Button
    Id=”Ribbon.ListItem.Actions.Controls.EmailButton”
    Alt=”Alert Ribbon Button”
    Sequence=”5″
    Command=”CMDAlertRibbonButton”
    Image32by32=”/_layouts/images/menulistsettings.gif”
    Image16by16=”/_layouts/images/itdcl.gif”
    LabelText=”Email To Someone”
    TemplateAlias=”o1″ />
    </CommandUIDefinition–>
    </CommandUIDefinitions>
    <CommandUIHandlers>
    <CommandUIHandler
    Command=”CMDRibbonButton”
    CommandAction=”javascript:
    function resultCallback(result, value)
    {
    SP.UI.Notify.addNotification(‘Success!’);
    SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
    }var ctx = SP.ClientContext.get_current();
    var items = SP.ListOperation.Selection.getSelectedItems(ctx);
    var myItems = ”;
    var i;for (i in items)
    {
    myItems += ‘|’ + items[i].id;
    }

    if(myItems != ”)
    {
    var options = {
    url: ‘{SiteUrl}/Pages/Page-to-Test-List.aspx?Items=’ + myItems + ‘&amp;ListType=100&amp;ListId={SelectedListId}&amp;Source={Source}’,
    tite: ‘My Page’,
    allowMaximize: false,
    showClose: true,
    width: 500,
    height: 500,
    dialogReturnValueCallback: resultCallback };

    SP.UI.ModalDialog.showModalDialog(options);
    } else {
    alert(‘Please select at lease one item’);
    }

    ” />
    </CommandUIHandlers>
    </CommandUIExtension>
    </CustomAction>

    <CustomAction
    Id=”CAAlertRibbonButton”
    RegistrationId=”101″
    RegistrationType=”List”
    Location=”CommandUI.Ribbon”
    Sequence=”5″
    Title=”Alert Ribbon Button”>
    <CommandUIExtension>
    <CommandUIDefinitions>
    <CommandUIDefinition
    Location=”Ribbon.Documents.Groups._children”>
    <Group
    Id=”MiTek.Documents”
    Sequence=”80″
    Description=”MiTek group”
    Title=”MiTek Custom”
    Template=”Ribbon.Templates.Flexible2″>
    <Controls Id=”MiTek.SharePoint.Administration.Application.Group.Controls”>
    <Button
    Id=”MiTek.Ribbon.Documents.EmailSomeone”
    Command=”CMDRibbonButton”
    Image32by32=”/Style%20Library/Custom%20Images/emailIcon.png”
    LabelText=”Email To Someone”
    TemplateAlias=”o2″
    Sequence=”20″ />
    </Controls>
    </Group>
    </CommandUIDefinition>
    <CommandUIDefinition
    Location=”Ribbon.Documents.Scaling._children”>
    <MaxSize
    Id=”MiTek.Ribbon.Documents.MaxSize”
    Sequence=”15″
    GroupId=”MiTek.Documents”
    Size=”LargeLarge” />
    </CommandUIDefinition>
    <!– Put in the Actions Group –>
    <!–CommandUIDefinition Location=”Ribbon.ListItem.Actions.Controls._children”>
    <Button
    Id=”Ribbon.ListItem.Actions.Controls.EmailButton”
    Alt=”Alert Ribbon Button”
    Sequence=”5″
    Command=”CMDAlertRibbonButton”
    Image32by32=”/_layouts/images/menulistsettings.gif”
    Image16by16=”/_layouts/images/itdcl.gif”
    LabelText=”Email To Someone”
    TemplateAlias=”o1″ />
    </CommandUIDefinition–>
    </CommandUIDefinitions>
    <CommandUIHandlers>
    <CommandUIHandler
    Command=”CMDRibbonButton”
    CommandAction=”javascript:
    function resultCallback(result, value)
    {
    SP.UI.Notify.addNotification(‘Success!’);
    SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
    }

    var ctx = SP.ClientContext.get_current();
    var items = SP.ListOperation.Selection.getSelectedItems(ctx);
    var myItems = ”;
    var i;

    for (i in items)
    {
    myItems += ‘|’ + items[i].id;
    }

    if(myItems != ”)
    {
    var options = {
    url: ‘{SiteUrl}/Pages/Page-to-Test-List.aspx?Items=’ + myItems + ‘&amp;ListType=101&amp;ListId={SelectedListId}&amp;Source={Source}’,
    tite: ‘My Page’,
    allowMaximize: false,
    showClose: true,
    width: 500,
    height: 500,
    dialogReturnValueCallback: resultCallback };

    SP.UI.ModalDialog.showModalDialog(options);
    } else {
    alert(‘Please select at lease one item’);
    }

    ” />
    </CommandUIHandlers>
    </CommandUIExtension>
    </CustomAction>

    </Elements>

  4. Deploy the project
Posted in SharePoint 2010, Visual Studio 2010 | Leave a comment