public void Initialize(ISharePointProjectService projectService)
 {
     var items = from pi in projectService.ProjectItemTypes
                 where pi.Key == "Microsoft.VisualStudio.SharePoint.ListDefinition"
                 select pi.Value;
     var listType = items.FirstOrDefault();
     listType.ProjectItemMenuItemsRequested += ContextMenuRequested;
 }
Esempio n. 2
0
        // Implements IProjectItemTypeProvider.InitializeType. Configures the behavior of the project item type.
        public void InitializeType(ISharePointProjectItemTypeDefinition projectItemTypeDefinition)
        {
            projectItemTypeDefinition.Name = "CustomAction";
            projectItemTypeDefinition.SupportedDeploymentScopes =
                SupportedDeploymentScopes.Site | SupportedDeploymentScopes.Web;
            projectItemTypeDefinition.SupportedTrustLevels = SupportedTrustLevels.All;

            // Get the service so that other code in this class can use it.
            projectService = projectItemTypeDefinition.ProjectService;

            // Handle some project item events.
            projectItemTypeDefinition.ProjectItemInitialized += ProjectItemInitialized;
            projectItemTypeDefinition.ProjectItemNameChanged += ProjectItemNameChanged;
            projectItemTypeDefinition.ProjectItemDisposing += ProjectItemDisposing;

            // Handle events to create a custom property and shortcut menu item for this project item.
            projectItemTypeDefinition.ProjectItemPropertiesRequested +=
                ProjectItemPropertiesRequested;
            projectItemTypeDefinition.ProjectItemMenuItemsRequested +=
                ProjectItemMenuItemsRequested;
        }