Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SharePoint功能部署中的计时_Sharepoint_Wss 3.0 - Fatal编程技术网

SharePoint功能部署中的计时

SharePoint功能部署中的计时,sharepoint,wss-3.0,Sharepoint,Wss 3.0,我有一个包含许多特性的wsp包。wsp包中包含的某些功能依赖于wsp包中的其他功能 在我的例子中,通过功能创建了两种内容类型(内容类型A和内容类型B),内容类型B继承自内容类型A 因此,显然,包含内容类型A(功能A)的功能需要在包含内容类型B(功能B)的功能之前部署 有没有办法在部署功能B之前先部署功能a?理想情况下,这两个功能将通过onet.xml文件自动激活,功能A将在之前部署,但我不知道如何做到这一点 我不一定要寻找解决这个特定问题的解决方案,但我想知道的是:如何处理SharePoint项

我有一个包含许多特性的wsp包。wsp包中包含的某些功能依赖于wsp包中的其他功能

在我的例子中,通过功能创建了两种内容类型(内容类型A和内容类型B),内容类型B继承自内容类型A

因此,显然,包含内容类型A(功能A)的功能需要在包含内容类型B(功能B)的功能之前部署

有没有办法在部署功能B之前先部署功能a?理想情况下,这两个功能将通过onet.xml文件自动激活,功能A将在之前部署,但我不知道如何做到这一点

我不一定要寻找解决这个特定问题的解决方案,但我想知道的是:如何处理SharePoint项目中依赖于其他功能的功能


谢谢

您可以使用功能激活依赖项。。。特色

<Feature Id="01c34560-6561-11dc-8314-0800200c9a66?
  Title="Nice to know"
  Description="This is a feature that adds a new sexy CSS"
  Version="1.0.0.0?
  Scope="Site"
  xmlns="http://schemas.microsoft.com/sharepoint/">
  <ActivationDependencies>
    <ActivationDependency FeatureId="F6924D36-2FA8-4f0b-B16D-06B7250180FA"/>
  </ActivationDependencies>
  <ElementManifests>
    <ElementManifest Location="ProvisionedFiles.xml"/>
  </ElementManifests>
</Feature>


概述。

您可以使用激活依赖项将功能相互关联。你使用

<ActivationDependencies> 
<ActivationDependency> 

您还可以创建事件处理程序,并按所需顺序激活功能。我发现,依靠代码手动执行操作总比使用xml文件来执行操作要好

看一看

下面是我如何在事件处理程序中对其进行编码的示例

public void ActivateFeatures(SPFeatureReceiverProperties properties)
{
    logger.Info("Creating content types");
    // feature is scoped at Site, so the parent is type SPSite rather than SPWeb..
    using (SPSite site = properties.Feature.Parent as SPSite)
    {
        SPWeb currentWeb = null;
        if (site != null)
        {
            currentWeb = site.RootWeb;
        }
        else
        {
            currentWeb = properties.Feature.Parent as SPWeb;
        }

        using (currentWeb)
        {
            if (currentWeb == null) return;

            try
            {
                currentWeb.Site.Features.Add(new Guid("01A27C0C-2E44-4298-A74F-8F50601A20B0")); // ctCategory
                currentWeb.Site.Features.Add(new Guid("496DFE3E-A41E-46e8-B627-29775F376017")); // ctChapter
                currentWeb.Site.Features.Add(new Guid("F2ECBD5A-4766-49bf-A158-62550661E141")); // ctChapterList
                currentWeb.Site.Features.Add(new Guid("8C91646F-1466-49d7-BB53-B666F164AA96")); // ctComments
                currentWeb.Site.Features.Add(new Guid("112E1564-FA1C-41fd-853A-F7569C555905")); // ctDocument
                currentWeb.Site.Features.Add(new Guid("48BD5A07-8DD1-46ef-9F05-9824380BA26E")); // ctExternalReviewer
                currentWeb.Site.Features.Add(new Guid("20553A8E-8272-400c-816D-6EE8E02F34E9")); // ctStandard
                currentWeb.Site.Features.Add(new Guid("E84259BD-E4B3-465e-8928-1745F8760F2D")); // ctSuggestion
                currentWeb.Site.Features.Add(new Guid("0B313654-D296-4bfa-8F21-E4FF33C1DD6C")); // ctTask
                currentWeb.Site.Features.Add(new Guid("EFDA877B-B686-4954-9F1A-65ADB32B2E50")); // ctDepartment
                currentWeb.Site.Features.Add(new Guid("4E4B984E-65E2-4601-A216-2C4D08AA97AE")); // ctInnerWork
                currentWeb.Site.Features.Add(new Guid("4D85D4B9-1909-45cd-81C7-CDBB0874492F")); // ctOtherDocuments
                logger.Info("Content types added successfully");
            }
            catch (Exception ex)
            {
                logger.Error("Could not in activate content types.", ex);
            }
        }
    }
}

+1-与激活依赖相比,我更喜欢这种方法。也许我是个控制狂,但我喜欢手动处理激活顺序:)谢谢,这正是我需要的。