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

SPUtility.SendEmail adds spaces and new lines to email body

Problem:

When using SPUtility.SendEmail  to send emails, sometimes it adds spaces and new lines to the email body automatically, or sometimes it even removes some characters, or change < to <.

Solution:

Add “\n” at the end of each paragraph or at the end of each row of your HTML table.

For example:

string emailBody = "<div>Hello,<br /><br />Just letting you know that the CityLink invoice/travel details have been reviewed by all the e-Tag holders.<br /><br />\n";
emailBody += "This is the library and you can view the workflow details here:<br /><br />\n";
emailBody += "<table><tr><th>Name</th><th>ID</th><th>Details</th><th>Date</th></tr>\n";

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

Create SharePoint Sequential Workflow with multiple tasks in Visual Studio 2010

What I wanted to Achieve:

  1. CityLink sends us an invoice (along with a csv file for travel details) every month. Before we made the payment, we need all e-Tag holders to review their travel details in the invoice and make sure they are correct.
  2. User uploads the TravelDetails.csv file into a document library.
  3. It triggers the workflow and creates tasks for e-Tag holders to review their travel details (These people are listed in a list called “e-Tag Holders”. This list contains people’s names in the TravelDetails.csv file and their corresponding user account in SharePoint)
  4. The workflow reads all the lines in the csv file and send diffrent part of the travel details to diffrent people via Emails. It also creates task for them so after they have reviewed their part of travel details, they can mark the task as complete.
  5. Once all tasks have been completed, it sends an email to a SharePoint group “CityLink Invoice Notification” telling them it is completed.

How I achived it:

Create a new project:

vswf1

Drag activities into the designer and it looks like this:

2015-09-18 10_50_10-SharePoint Development (Snapshot 1) [Running] - Oracle VM VirtualBox

This is the properties of onWorkflowActivated1:

2015-09-18 10_52_56-SharePoint Development (Snapshot 1) [Running] - Oracle VM VirtualBox

Properties of replicatorActivity1:

2015-09-18 10_55_53-SharePoint Development (Snapshot 1) [Running] - Oracle VM VirtualBox

Properties of createTask1:

2015-09-18 10_58_22-SharePoint Development (Snapshot 1) [Running] - Oracle VM VirtualBox

When binding the ListItemId, TaskId and TaskProperties, click the little … button on the right, and then click “Bind to a new member”, select “Create Field”:

2015-09-18 12_10_38-SharePoint Development (Snapshot 1) [Running] - Oracle VM VirtualBox

Properties of onTaskCreated1 (This activity does nothing, but deleting it made my workflow not working for some unknown reason):

2015-09-18 10_59_07-SharePoint Development (Snapshot 1) [Running] - Oracle VM VirtualBox

CodeAcitivity1:

2015-09-18 11_00_35-SharePoint Development (Snapshot 1) [Running] - Oracle VM VirtualBox

whileActivity1:

2015-09-18 11_01_52-SharePoint Development (Snapshot 1) [Running] - Oracle VM VirtualBox

onTaskChanged1:

2015-09-18 11_02_58-SharePoint Development (Snapshot 1) [Running] - Oracle VM VirtualBox

completeTask1:

2015-09-18 11_04_16-SharePoint Development (Snapshot 1) [Running] - Oracle VM VirtualBox

codeActivity2:

2015-09-18 11_05_09-SharePoint Development (Snapshot 1) [Running] - Oracle VM VirtualBox

Code Behind:

using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Workflow;
using Microsoft.SharePoint.WorkflowActions;
using System.Text;
using System.IO;
using System.Data;
using Microsoft.SharePoint.Utilities;
using System.Collections.Specialized;

namespace Workflow_CityLink_Invoices.Workflow1
{
public sealed partial class Workflow1 : SequentialWorkflowActivity
{
public Workflow1()
{
InitializeComponent();
}

public Guid workflowId = default(System.Guid);
public SPWorkflowActivationProperties workflowProperties = new SPWorkflowActivationProperties();
int countTask = 0;
int countCompletedTask = 0;
int counter = 0;

string invoicePeriod = “”;

ArrayList assignees = null;
DataTable dtInvoice = new DataTable();
DataTable dtETagHolders = new DataTable();

public Guid createTask1_TaskId1 = default(System.Guid);
public SPWorkflowTaskProperties createTask1_TaskProperties1 = new Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties();

public String taskOutcome = default(System.String);
private bool isFinished = false;

public Int32 createTask1_ListItemId1 = default(System.Int32);

private void LogComment(string logMessage, string outcome)
{
SPWorkflow.CreateHistoryEvent(workflowProperties.Web, this.WorkflowInstanceId, 0, workflowProperties.Web.CurrentUser, new TimeSpan(), outcome, logMessage, string.Empty);
}

private void onWorkflowActivated1_Invoked(object sender, ExternalDataEventArgs e)
{
// Initialisation
countTask = 0;
countCompletedTask = 0;
counter = 0;
workflowId = Guid.NewGuid();

dtInvoice.Columns.Add(“Name”, Type.GetType(“System.String”));
dtInvoice.Columns.Add(“LicencePlate”, Type.GetType(“System.String”));
dtInvoice.Columns.Add(“eTag”, Type.GetType(“System.String”));
dtInvoice.Columns.Add(“TravelDetails”, Type.GetType(“System.String”));
dtInvoice.Columns.Add(“StartDate”, Type.GetType(“System.String”));
dtInvoice.Columns.Add(“StartTime”, Type.GetType(“System.String”));
dtInvoice.Columns.Add(“FinishDate”, Type.GetType(“System.String”));
dtInvoice.Columns.Add(“FinishTime”, Type.GetType(“System.String”));
dtInvoice.Columns.Add(“GST”, Type.GetType(“System.String”));
dtInvoice.Columns.Add(“Amount”, Type.GetType(“System.String”));

dtETagHolders.Columns.Add(“NameInCSV”, Type.GetType(“System.String”));
dtETagHolders.Columns.Add(“loginName”, Type.GetType(“System.String”));
dtETagHolders.Columns.Add(“travelDetails”, Type.GetType(“System.String”));
dtETagHolders.Columns.Add(“userEmail”, Type.GetType(“System.String”));
dtETagHolders.Columns.Add(“userID”, Type.GetType(“System.Int32”));
dtETagHolders.Columns.Add(“emailSent”, Type.GetType(“System.String”));

// Create a set of assignees for task.
assignees = new ArrayList();

SPList eTagHoldersList = workflowProperties.Web.Lists[“e-Tag Holders”];
SPListItemCollection listItems = eTagHoldersList.Items;
foreach (SPListItem item in listItems)
{
string nameInCSV = item[“Title”].ToString();
int userID = Convert.ToInt32(item[“Account Name”].ToString().Substring(0, item[“Account Name”].ToString().IndexOf(“;#”)));
SPUser theUser = workflowProperties.Web.SiteUsers.GetByID(userID);
string loginName = theUser.LoginName;
string email = theUser.Email;
assignees.Add(loginName);

DataRow dr = dtETagHolders.NewRow();
dr[0] = nameInCSV;
dr[1] = loginName;
dr[3] = email;
dr[4] = userID;
dtETagHolders.Rows.Add(dr);
}

SPListItem currentItem = workflowProperties.Item;

try
{
string contents = string.Empty;
string filePath = currentItem.Url;
SPFile spfile = workflowProperties.Web.GetFile(filePath);
if (spfile.Exists)
{

StreamReader file = new StreamReader(spfile.OpenBinaryStream());
string line;
int index = 0;
int flag = 1000;
while ((line = file.ReadLine()) != null)
{
char[] splitter = { ‘,’ };
String[] arrLine = line.ToString().Split(splitter);

if (arrLine[0] == “Invoice period”)
{
invoicePeriod = Convert.ToString(arrLine[1]);
}

if (arrLine[0] == “Fleet identifier”)
{
flag = index;
}
if (index > flag + 2)
{
if (!String.IsNullOrEmpty(Convert.ToString(arrLine[0])))
{
DataRow dr = dtInvoice.NewRow();
dr[0] = arrLine[0];
dr[1] = arrLine[1];
dr[2] = arrLine[2];
dr[3] = arrLine[3];
dr[4] = arrLine[4];
dr[5] = arrLine[5];
dr[6] = arrLine[6];
dr[7] = arrLine[7];
dr[8] = arrLine[8];
dr[9] = arrLine[9];
dtInvoice.Rows.Add(dr);
}
}

index++;
}

}

}
catch (Exception ex)
{
LogComment(ex.ToString(), “Error”);
}

}

private void replicateTasks_Initialized(object sender, EventArgs e)
{

replicatorActivity1.InitialChildData = assignees;
}

private string checkNameInCSV(string loginName)
{
string result = “”;
foreach (DataRow dr in dtETagHolders.Rows)
{
string nameInCSV = Convert.ToString(dr[0]);
string loginName2 = Convert.ToString(dr[1]);
if (loginName.ToUpper() == loginName2.ToUpper())
{
result = nameInCSV.ToUpper();
break;
}
}
return result;
}

private void createTask1_MethodInvoking(object sender, EventArgs e)
{
// Triggered When creating a new task

// Initialisation
isFinished = false;

createTask1_TaskProperties1 = new SPWorkflowTaskProperties();
createTask1_TaskId1 = Guid.NewGuid();
createTask1_TaskProperties1.Title = “Please review CityLink travel details ” + invoicePeriod;

string assignedTo = replicatorActivity1.InitialChildData[countTask].ToString();
string html = “”;
string nameInCSV = checkNameInCSV(assignedTo);

foreach (DataRow dr1 in dtInvoice.Rows)
{
bool matched = false;
if (Convert.ToString(dr1[0]).ToUpper() == nameInCSV)
{
matched = true;
}

if (matched)
{
html += “<tr><td>” + dr1[0] + “</td><td>” + dr1[1] + “</td><td>” + dr1[2] + “</td><td>” + dr1[3] + “</td><td>” + dr1[4] + ” ” + dr1[5] + “</td><td>” + dr1[6] + ” ” + dr1[7] + “</td><td>” + dr1[9] + “</td></tr>”;

}
}

foreach (DataRow dr1 in dtETagHolders.Rows)
{
if (Convert.ToString(dr1[1]).ToUpper() == assignedTo.ToUpper())
{
dr1[2] = html;
}
}

createTask1_TaskProperties1.AssignedTo = assignedTo;
createTask1_TaskProperties1.Description = “”;

countTask++;
}

private void codeActivity1_method(object sender, EventArgs e)
{
try
{
if (counter == 0) // only happen once
{
string currentFileName = workflowProperties.Item.Name;

SPListItemCollection listItems = workflowProperties.TaskList.Items;

foreach (SPListItem item in listItems) // check all items in the Task list
{
string relatedContent1 = Convert.ToString(item[“Related Content”]);
string status = item[“Status”].ToString();

if (relatedContent1 != null && relatedContent1 != “”)
{
relatedContent1 = relatedContent1.Substring(relatedContent1.LastIndexOf(“,”) + 2) + “.CSV”;

if (relatedContent1.ToUpper() == currentFileName.ToUpper() && status != “Completed”) // only if the tasks’ related item is current file
{
string theID = item[“ID”].ToString();
string assignedTo = item[“Assigned To”].ToString();
string taskTitle = Convert.ToString(item[“Title”]);
string relatedContent = item[“Related Content”].ToString();

string currentTaskURL = “http://sharepoint.xxxxx.com.au&#8221; + workflowProperties.TaskListUrl + “/EditForm.aspx?ID=” + theID;
int key = Convert.ToInt32(theID) * 3 + 4;
string completeTaskLink = “mailto:au.sharepoint@xxxxx.com.au?subject=MarkAsComplete**SPEmail**” + theID + “**” + key.ToString() + “**http://sharepoint.xxxxx.com.au/hr/**2fa6e7a8-23ab-46f3-96d9-d3bf24fd743e**” + taskTitle;
currentTaskURL = currentTaskURL.Replace(“/lits/”, “/lists/”);
foreach (DataRow dr1 in dtETagHolders.Rows) // check through all items in the “e-Tag Holders” DataTable
{
string name = Convert.ToString(dr1[0]);
string firstname = name .Substring(0, name .IndexOf(” “));

string loginName = Convert.ToString(dr1[1]);
string travelDetails = Convert.ToString(dr1[2]);

string userEmail = Convert.ToString(dr1[3]);
int userID = Convert.ToInt32(dr1[4]);
string emailSent = Convert.ToString(dr1[5]);

// If the email hasn’t been sent for this person AND the “assigned to” for the Task is the same as the userID
if (emailSent != “1” && userID.ToString() == assignedTo.Substring(0, assignedTo.IndexOf(“;”)))
{

string emailBody = “<style type=\”text/css\”>body, div, span { font-family:arial; font-size:10pt;} table.GridView { font-family:arial; margin:0; font-size: 8pt; width: 100%; text-align: left; border-left:1px solid #dddddd; border-top:1px solid #dddddd; } table.GridView tr th { border:0; border-right:1px solid #dddddd; border-bottom:1px solid #dddddd; background-color:#333333; color:white; padding:10px; } table.GridView tr td { font-size: 8pt; padding: 8px 6px; border:0; border-right:1px solid #dddddd; border-bottom:1px solid #dddddd; } .donotprint { display:none; } a, a:visited {     color:#0072bc;     text-decoration:none;} h2 { font-size:14pt; } .theGrid tr td { padding:8px; } div#tabs { position:relative; padding:0; } div#tabs span.number { display:none; } div#tabs a, div#tabs a:link, div#tabs a:visited { display:none; } div#tabs a.current, div#tabs a.currentHover { border:1px solid #cccccc; color:#333333; float:left; text-align:center; border-bottom:0;  display:block; padding:8px; color:#000000; background-color:#ffffff; text-decoration:none;border-radius:3px 10px 0px 0px; } div#tabs a.hidden {display:none;} div.panel { padding:15px; border:1px solid #cccccc; background-color:#ffffff;display:block; border-collapse:separate;border-radius:0 10px 10px 10px; box-shadow: 2px 2px 2px #cccccc;} div.detailsAreaHidden {display:none; } img { display:none; } table.tableForm tr th,table.tableForm tr td { text-align:left; font-size: 10pt; } table.tableForm tr.alt th, table.tableForm tr.alt td { background-color:#f6f6f6; } .clearall {clear:both;} .left { float:left; } .doNotEmail { display:none; } </style>”;
emailBody += ”

Hi ” + firstname + “,

A CityLink invoice with travel details has been uploaded to SharePoint. Please review the following CityLink travel details:

“;
emailBody += ”

“; emailBody += “”;string emailBody2 = ”

Name Licence Plate e-Tag Travel Details Start Date/Time Finish Date/Time Cost

If the travel details above are correct, please click here to open the task, change the status to \”Completed\”, and then click \”Save\”.

“;
emailBody2 += “Complete the task via Email:

“;
emailBody2 += “If you are not on the company’s network (i.e., you are not in the office or connected via VPN), you can complete this task via email.

“;
emailBody2 += “Click on one of the following links and it will open a new email window. Make sure you leave the email subject unchanged.

“;
emailBody2 += ”    > Approve via Email

“;
emailBody2 += “SharePoint will send you an email once it has received your email and completed the task for you (this may takes a few minutes).

“;
emailBody2 += “If you found any errors please notify the HR manager.

Kind regards,
SharePoint
Sent from Workflow developed in VS2010

“;

StringDictionary headers = new StringDictionary();
headers.Add(“to”, userEmail);
headers.Add(“cc”, “”);
headers.Add(“bcc”, “”);
headers.Add(“subject”, “Please review CityLink travel details ” + invoicePeriod);
headers.Add(“content-type”, “text/html”);
SPUtility.SendEmail(workflowProperties.Web, headers, emailBody + travelDetails + emailBody2);

//SPUtility.SendEmail(workflowProperties.Web, true, false, userEmail, “Please review CityLink travel details”, emailBody);
dr1[5] = “1”;

break; // found the person, stop the loop
}

}
}
}
}

counter++;
}
}
catch (Exception ex)
{
LogComment(ex.ToString(), “Error”);
}
}

private void codeActivity2_method(object sender, EventArgs e)
{
try
{
string to = “”;
foreach (SPGroup spg in workflowProperties.Web.SiteGroups)
{
if (spg.Name == “CityLink Invoice Notification”)
{
foreach (SPUser user in spg.Users)
{
to += user.Email + “;”;
}
break;
}
}

string emailBody = “<style type=\”text/css\”>body, div, span { font-family:arial; font-size:10pt;} table.GridView { font-family:arial; margin:0; font-size: 8pt; width: 100%; text-align: left; border-left:1px solid #dddddd; border-top:1px solid #dddddd; } table.GridView tr th { border:0; border-right:1px solid #dddddd; border-bottom:1px solid #dddddd; background-color:#333333; color:white; padding:10px; } table.GridView tr td { font-size: 8pt; padding: 8px 6px; border:0; border-right:1px solid #dddddd; border-bottom:1px solid #dddddd; } .donotprint { display:none; } a, a:visited {     color:#0072bc;     text-decoration:none;} h2 { font-size:14pt; } .theGrid tr td { padding:8px; } div#tabs { position:relative; padding:0; } div#tabs span.number { display:none; } div#tabs a, div#tabs a:link, div#tabs a:visited { display:none; } div#tabs a.current, div#tabs a.currentHover { border:1px solid #cccccc; color:#333333; float:left; text-align:center; border-bottom:0;  display:block; padding:8px; color:#000000; background-color:#ffffff; text-decoration:none;border-radius:3px 10px 0px 0px; } div#tabs a.hidden {display:none;} div.panel { padding:15px; border:1px solid #cccccc; background-color:#ffffff;display:block; border-collapse:separate;border-radius:0 10px 10px 10px; box-shadow: 2px 2px 2px #cccccc;} div.detailsAreaHidden {display:none; } img { display:none; } table.tableForm tr th,table.tableForm tr td { text-align:left; font-size: 10pt; } table.tableForm tr.alt th, table.tableForm tr.alt td { background-color:#f6f6f6; } .clearall {clear:both;} .left { float:left; } .doNotEmail { display:none; } </style>”;
emailBody += ”

Hello,

Just letting you know that this CityLink invoice/travel details ” + invoicePeriod + “ have been reviewed by all the e-Tag holders:

“;
//emailBody += “Click here to view workflow history

“;
emailBody += “Kind regards,
SharePoint
Sent from Workflow developed in VS2010

“;

StringDictionary headers = new StringDictionary();
headers.Add(“to”, to);
headers.Add(“cc”, “”);
headers.Add(“bcc”, “”);
headers.Add(“subject”, “CityLink travel details has been reviewed by all e-Tag holders”);
headers.Add(“content-type”, “text/html”);
SPUtility.SendEmail(workflowProperties.Web, headers, emailBody);
LogComment(“Workflow completed. Notification sent to ” + to, “Log”);
}
catch (Exception ex)
{
LogComment(ex.ToString(), “Error Message”);
}
}

private void while1Invoke(object sender, ConditionalEventArgs e)
{
e.Result = !isFinished;
}

private void task1Changed1Invoke(object sender, ExternalDataEventArgs e)
{

int tid = onTaskChanged1_AfterProperties1.TaskItemId;
SPListItem task = workflowProperties.TaskList.GetItemById(tid);

if (Convert.ToString(task[“Status”]) == “Completed”)
{
isFinished = true;
countCompletedTask++;
string assignedTo = Convert.ToString(task[“Assigned To”]);
assignedTo = assignedTo.Substring(assignedTo.IndexOf(“#”) + 1);
LogComment(assignedTo + ” has complete the task (Task ID: ” + tid + “). ” + countCompletedTask + ” of ” + assignees.Count + ” completed”, “Completed”);
}
}

private void completeTask1_MethodInvoking(object sender, EventArgs e)
{
try
{
}
catch (Exception ex)
{
LogComment(ex.ToString(), “”);
}

}

private void repCompleted(object sender, ConditionalEventArgs e)
{
e.Result = (countCompletedTask == assignees.Count);
}

public static DependencyProperty onTaskChanged1_AfterProperties1Property = DependencyProperty.Register(“onTaskChanged1_AfterProperties1”, typeof(Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties), typeof(Workflow_CityLink_Invoices.Workflow1.Workflow1));

[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
[BrowsableAttribute(true)]
[CategoryAttribute(“Misc”)]
public SPWorkflowTaskProperties onTaskChanged1_AfterProperties1
{
get
{
return ((Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties)(base.GetValue(Workflow_CityLink_Invoices.Workflow1.Workflow1.onTaskChanged1_AfterProperties1Property)));
}
set
{
base.SetValue(Workflow_CityLink_Invoices.Workflow1.Workflow1.onTaskChanged1_AfterProperties1Property, value);
}
}

public static DependencyProperty onTaskChanged1_BeforeProperties1Property = DependencyProperty.Register(“onTaskChanged1_BeforeProperties1”, typeof(Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties), typeof(Workflow_CityLink_Invoices.Workflow1.Workflow1));

[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
[BrowsableAttribute(true)]
[CategoryAttribute(“Misc”)]
public SPWorkflowTaskProperties onTaskChanged1_BeforeProperties1
{
get
{
return ((Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties)(base.GetValue(Workflow_CityLink_Invoices.Workflow1.Workflow1.onTaskChanged1_BeforeProperties1Property)));
}
set
{
base.SetValue(Workflow_CityLink_Invoices.Workflow1.Workflow1.onTaskChanged1_BeforeProperties1Property, value);
}
}

}
}

Deploy the workflow:

  1. Deploy the project on the production server, then go to your site collection’s root site;
  2. Go “Site Actions > Site Settings”;
  3. Go to “Site Collection Features” under “Site Collection Administration”, activate the feature for this workflow.
  4. Go to the library and then “Library > Workflow Settings”;
  5. Click “Add a workflow”, you can then select the workflow name, task list, and workflow history list.
Posted in SharePoint 2010, Visual Studio 2010, Workflow | 1 Comment

Delay Activity in SharePoint 2010 Workflow (Visual Studio 2010) Not Firing

Three settings needed to be modified. Workflow Throttle, Workflow Batch, and the Hidden Workflow Timer.
You can check the current throttle setting by running the following command:

stsadm -o getproperty -pn workflow-eventdelivery-throttle

Here is my new setting:

stsadm -o setproperty -pn workflow-eventdelivery-throttle -pv “45”

You can check the current batch size setting by running the following command:

stsadm -o getproperty -pn workitem-eventdelivery-batchsize
Here is my new setting:

stsadm -o setproperty -pn workitem-eventdelivery-batchsize -pv “250”

You can check the current interval setting by running the following command, in which you replace the URL with a valid path to a SharePoint application:

stsadm -o getproperty -pn job-workflow -url http://yoursiteurl
Here is my setting:

stsadm -o setproperty -pn job-workflow -pv “Every 5 minutes between 0 and 59” -url http://yoursiteurl

The key part is that now provided I restart the Microsoft SharePointTimer service between deploys, it actually completes a delay!  So remember to recycle the “SharePoint 2010 Timer” service before you deploy a new version of the workflow to the farm.

To debug any code that runs after a delay, you have to attach Visual Studio to the timer service (owstimer.exe), not the w3w process.  I do this by switching off “auto retract after debugging” in the “SharePoint” page of the project’s properties file and manually attaching to the OWSTIMER.EXE process.

(The above is from the internet google search)

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