<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Deployment Archives - Blog IT</title>
	<atom:link href="https://blogit.create.pt/category/deployment/feed/" rel="self" type="application/rss+xml" />
	<link>https://blogit.create.pt/category/deployment/</link>
	<description>Create IT blogger community</description>
	<lastBuildDate>Wed, 15 Mar 2023 12:52:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>
	<item>
		<title>Performing broker migrations on your Kafka consumers</title>
		<link>https://blogit.create.pt/joaorafael/2023/03/15/kafka-consumer-broker-migration-aws-msk/</link>
					<comments>https://blogit.create.pt/joaorafael/2023/03/15/kafka-consumer-broker-migration-aws-msk/#respond</comments>
		
		<dc:creator><![CDATA[João Rafael]]></dc:creator>
		<pubDate>Wed, 15 Mar 2023 12:44:45 +0000</pubDate>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[Kafka]]></category>
		<category><![CDATA[migrations]]></category>
		<category><![CDATA[MSK]]></category>
		<category><![CDATA[Streaming]]></category>
		<guid isPermaLink="false">https://blogit.create.pt/?p=12805</guid>

					<description><![CDATA[<p>When using Kafka for communication between systems, you may find yourself having to change your consumer configuration. This may happen due to the publisher changing topic, or a new message broker being created and a company-wide mandate that everyone switch until a set date. Doing this sort of migration isn&#8217;t very complicated, but any errors [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/joaorafael/2023/03/15/kafka-consumer-broker-migration-aws-msk/">Performing broker migrations on your Kafka consumers</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>When using Kafka for communication between systems, you may find yourself having to change your consumer configuration. This may happen due to the publisher changing topic, or a new message broker being created and a company-wide mandate that everyone switch until a set date. Doing this sort of migration isn&#8217;t very complicated, but any errors may prove to be costly. If we re-consume a new topic from the beginning, for example, we may accidentally fill up our database, for example. We want to start consuming the new topic at around the same time we stopped consuming the old one (with a buffer of a few minutes preferably, just to be safe).</p>



<p>The first step here is to ensure that your consumer code is idempotent, but that’s something that you should always ensure &#8211; just imagine that you have to re-consume a couple of messages, in that case lacking idempotency may result in your system getting strange data and bugs.</p>



<h2 class="wp-block-heading">Setting up Kafka on your machine</h2>



<p><em>(Feel free to skip this section if you have everything set up.)</em></p>



<p>Kafka releases aren’t included in most package managers, except for Homebrew in Mac systems. They should be available, however, in the <a href="https://kafka.apache.org/downloads" target="_blank" rel="noreferrer noopener">official download page</a>. For Unix systems (Mac, Linux, WSL, *BSD), simply get one of the binary downloads and extract it wherever you prefer. Then, make sure to add the bin folder to your $PATH, so that you can use these scripts in any folder. In my case, I put the extracted archive in $HOME/.local/share/kafka, so I edit my .zshrc (or .bashrc in a plainer Linux/WSL system) and add:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
export PATH=$HOME/.local/share/kafka/bin:$PATH
</pre></div>


<p><br>Now we can use the official kafka scripts in any directory. That is, unless we have some form of authentication. We can add additional configs to a file somewhere, and include that file in our commands. Let’s put a file called <code>dev.cfg</code> in <code>$HOME/.config/kafka/</code> (the exact directory doesn’t matter, but .config is the appropriate directory for configs), and write the following on it:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
security.protocol=SASL_SSL
sasl.mechanism=SCRAM-SHA-512
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required \
    username=&quot;me&quot; \
    password=&quot;noneofyourbusiness&quot;;
</pre></div>


<p>This is just an example, your broker&#8217;s security config may vary. After doing this, just add to any of the Kafka commands you use:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
--command-config $HOME/.config/kafka/dev.cfg
</pre></div>


<h2 class="wp-block-heading">Checking consumer offsets</h2>



<p>Before migrating topics, it&#8217;s best if we make sure that the old topic consumer is totally up-to-date. We can use this command to check the consumption lag:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
kafka-consumer-groups.sh \
	--bootstrap-server=&#039;&lt;your broker endpoints, separated by commas&gt;&#039; \
	--describe \
	--group=&#039;&lt;your consumer group&gt;&#039;

</pre></div>


<p>This should yield something like the output below:</p>



<pre class="wp-block-code"><code>TOPIC      PARTITION   NEWEST_OFFSET   OLDEST_OFFSET     CONSUMER_OFFSET     LEAD         LAG
your-topic 0           30000000        0                 30000000            30000000     0
your-topic 1           23900000        0                 23900000            23900000     0

CLIENT_HOST      CLIENT_ID         TOPIC          ASSIGNED_PARTITIONS
/128.0.0.0       your-consumer     your-topic     0
/128.0.0.1     	 your-consumer     your-topic     1</code></pre>



<p>From this we can see that there is zero lag, since the newest offset is equal to the consumer offset on both partitions. We can also see that our consumers are still running (they&#8217;re the clients with ID &#8220;your-consumer&#8221;).</p>



<h2 class="wp-block-heading">Performing the Kafka consumer migration</h2>



<p>Before switching topics or brokers, we should first create a consumer group for the new configuration. This will allow us to change the offsets <em>before</em> beginning the message consumption proper. The easiest way to do this is to use <a href="https://github.com/edenhill/kcat"><code>kcat</code></a>, a simple command-line tool that allows us to consume and produce Kafka messages. To create a consumer group, you must consume messages, so it&#8217;s a matter of setting up <code>kcat</code> (check the install guide on the kcat repo) and consuming a few messages from the new topic:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
kcat \
	-C \
	-b &#039;&lt;your brokers&gt;&#039; \
	-t new-topic \
	-G new-consumer-group

# If you have authentication, just add: 

	-X security.protocol=SASL_SSL \
	-X sasl.mechanisms=SCRAM-SHA-512 \
	-X sasl.username=&quot;me&quot; \
	-X sasl.password=&quot;noneofyourbusiness&quot;

</pre></div>


<p>Just run this for a second, check that messages come out, and then run the describe command for the new group:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
kafka-consumer-groups.sh \
	--bootstrap-server=&#039;new-broker&#039; \
	--describe \
	--group=&#039;new-group&#039;


TOPIC     PARTITION   NEWEST_OFFSET   OLDEST_OFFSET     CONSUMER_OFFSET     LEAD         LAG
new-topic 0           12387000        0                 12                  12           12386988
new-topic 1           12360000        0                 38                  38           12359962

CLIENT_HOST      CLIENT_ID         TOPIC          ASSIGNED_PARTITIONS
</pre></div>


<p>We have huge lag here, but that&#8217;s fine, as we&#8217;re going to reset the offsets anyway. Stop the workers consuming from the older topic by whatever means you can and note down the time at which they stopped. We will now reset the consumer group offset for this new group. Just a note: in this case, we don&#8217;t have any consumers connected to this group, but if we did we&#8217;d also have to turn them off. You <strong>cannot</strong> reset a consumer group offset if there are clients connected to it.</p>



<p>To reset the offsets, just run the following command (here we&#8217;ll assume that we stopped the previous consumers at 10:00 of March 15th, 2023, and subtract ten minutes just to be safe):</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
kafka-consumer-groups.sh \
	--bootstrap-server=&#039;new-brokers&#039; \
	--group=&#039;new-group&#039; \
	--topic=&#039;new-topic&#039; \
	--reset-offsets \
	--to-datetime 2023-03-15T09:50:00.000 \
	--dry-run
</pre></div>


<p>Running this dry run will not make any changes, It will only show you the new offsets for the consumer group, e.g.:</p>



<pre class="wp-block-code"><code>TOPIC     PARTITION   NEWEST_OFFSET   OLDEST_OFFSET     CONSUMER_OFFSET     LEAD         LAG
new-topic 0           12387000        0                 12386998            12386988     2
new-topic 1           12360000        0                 12369951            12369951     49

CLIENT_HOST      CLIENT_ID         TOPIC          ASSIGNED_PARTITIONS</code></pre>



<p>If nothing looks strange to you, go ahead, substitute <code>--dry-run</code> with <code>--execute</code> and run the command. Afterwards, deploy the new consumer configuration, turn on the worker, and let it run.</p>
<p>The post <a href="https://blogit.create.pt/joaorafael/2023/03/15/kafka-consumer-broker-migration-aws-msk/">Performing broker migrations on your Kafka consumers</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/joaorafael/2023/03/15/kafka-consumer-broker-migration-aws-msk/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Entity Framework &#8211; Update Database using Azure Pipelines</title>
		<link>https://blogit.create.pt/vini/2022/11/07/entity-framework-update-database-using-azure-pipelines/</link>
					<comments>https://blogit.create.pt/vini/2022/11/07/entity-framework-update-database-using-azure-pipelines/#respond</comments>
		
		<dc:creator><![CDATA[Vinícius Biavatti]]></dc:creator>
		<pubDate>Mon, 07 Nov 2022 11:18:06 +0000</pubDate>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[Microsoft Azure]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[entity framework]]></category>
		<category><![CDATA[migrations]]></category>
		<category><![CDATA[pipelines]]></category>
		<category><![CDATA[sql database]]></category>
		<guid isPermaLink="false">https://blogit.create.pt/?p=12770</guid>

					<description><![CDATA[<p>Introduction The pipelines bring to us the opportunity to create automatic tasks to execute development operations, like deploys, migrations, tests, etc. Focused in the deploy routine, some applications need other operations to ensure the stability between the application and other resources, like the database. During the development process, the developers usually customize and improve the [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/vini/2022/11/07/entity-framework-update-database-using-azure-pipelines/">Entity Framework &#8211; Update Database using Azure Pipelines</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Introduction</h2>



<p>The pipelines bring to us the opportunity to create automatic tasks to execute development operations, like deploys, migrations, tests, etc. Focused in the deploy routine, some applications need other operations to ensure the stability between the application and other resources, like the database.</p>



<p>During the development process, the developers usually customize and improve the application database in the development environment scope, and it can be made easily by using frameworks that contains routines to create source files that have the responsability to keep the history of changes and are used to update the database for determinated version. These files are known as migrations.&nbsp;</p>



<p>In this post, we will see how to apply migrations for the databases that are located in different environments (staging, production, etc.), using the Code-First entity concept, and the Entity Framework Core.</p>



<h2 class="wp-block-heading">Migrations</h2>



<p>To generate database migrations, we can execute the &#8220;Add-Migraton &lt;name&gt;&#8221; command from the Entity Framework. This command will generate some source files that will contain the code to apply the migration to the database. To execute these migration files, you just need to execute the &#8220;Update-Database&#8221; command. But,&nbsp;<a href="https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/applying?tabs=dotnet-core-cli#sql-scripts" target="_blank" rel="noreferrer noopener">Microsoft recommends</a>&nbsp;to create a SQL file individually, and suggest to execute this file direct to the database, without need to execute an intermediary software (C# + EF) to access the database. To do this, we will have to follow the steps below:</p>



<ul class="wp-block-list">
<li>1. Create a Pipeline in Azure Devops;</li>



<li>2. Install dotnet-ef-tool;</li>



<li>3. Generate SQL script;</li>



<li>4. Execute SQL script to the database;</li>



<li>5. Script File as a Pipeline Artifact.</li>
</ul>



<p><em><strong>NOTE</strong>: We don&#8217;t need to worry about which migration need to be applyed to the database. The dotnet-ef-tool command will generate a script cantaining the needed logic. Check the third step for more details.</em></p>



<h2 class="wp-block-heading">1. Create a Pipeline in Azure Devops</h2>



<p>We will create a common deployment pipeline in Azure Devops for ASP.NET Core backend applications. Check the end of the post to see the full result of the pipeline.</p>



<h2 class="wp-block-heading">2. Install dotnet-ef-tool</h2>



<p>To execute tool commands of Entity Framework, we have to install a package named dotnet-ef-tool. This needs to be available into the pipeline&#8217;s context to be used for the SQL script generation. To install this tool by a pipeline task, we can use the task below:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; title: ; notranslate">
- task: DotNetCoreCLI@2
  displayName: &#039;Install EF tool&#039;
  inputs:
    command: &#039;custom&#039;
    custom: &#039;tool&#039;
    arguments: &#039;install --global dotnet-ef&#039;
</pre></div>


<h2 class="wp-block-heading">3. Generate SQL script</h2>



<p>To generate the SQL script containing the logic to apply migrations, we will use the dotnet-ef-tool. By default, the command does not generate the logic to check which migration should be applied, so we have to enable this behavior using the parameter: &#8211;idempotent. By using this behavior, we don&#8217;t need to worry about the migrations that will be applyed to the database since the generated script already has it. Below, you can see the task that could be used to generate the script file:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; title: ; notranslate">
- task: DotNetCoreCLI@2
  displayName: &#039;Generate SQL Script&#039;
  inputs:
    command: &#039;custom&#039;
    custom: &#039;ef&#039;
    arguments: &#039;migrations script --idempotent --project $(Build.SourcesDirectory)\Data.csproj --output $(System.ArtifactsDirectory)/script.sql&#039;
</pre></div>


<p><em><strong>NOTE</strong>: We don&#8217;t need to stablish any database connection for the script generation, since we are following the Code First concept for entity creation, so, the command will just look at the entities source code of the project to generate the SQL file. If we don&#8217;t use the &#8211;idempotent argument, the script will generate the SQL without the conditional logic to determinate which migration should be applied, causing an error if the database already exists.</em></p>



<h2 class="wp-block-heading">4. Execute SQL script to the database</h2>



<p>Now, with the SQL script available, we just need to execute this file to the database. In this post, we will use a common Azure Database as an example, so for this case, we can use the following task to accomplish this requirement:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; title: ; notranslate">
- task: SqlAzureDacpacDeployment@1
  displayName: &#039;Update Database&#039;
  inputs:
    azureSubscription: &#039;&lt;Service Connection Identifier&gt;&#039;
    AuthenticationType: &#039;connectionString&#039; # You can use other method to authenticate to the database if you want
    ConnectionString: &#039;&lt;Database Connection String&gt;&#039;
    deployType: &#039;SqlTask&#039;
    SqlFile: &#039;$(System.ArtifactsDirectory)/script.sql&#039;
</pre></div>


<h2 class="wp-block-heading">5. Script File as a Pipeline Artifact</h2>



<p>Well done. The last task will only be used to make the file available to be accessed by the pipeline runner user. To do this, you can use the task below to add the generated script.sql file to the file bundle (artifacts). To check the artifacts, just access the artifacts option from the pipeline details after the job&#8217;s execution.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; title: ; notranslate">
- task: PublishBuildArtifacts@1
  displayName: &#039;Publish Artifacts&#039;
  inputs:
    PathtoPublish: &#039;$(System.ArtifactsDirectory)/script.sql&#039;
    ArtifactName: &#039;$(artifactName)&#039;
    publishLocation: &#039;Container&#039;
</pre></div>


<h2 class="wp-block-heading">Conclusion</h2>



<p>In this post, we could learn an easy way to apply the database migrations to the remote environment by using automation (pipelines) to accomplish it. This method is simple, and does not have any database validation before script execution. So, if you have an active and sensitive environment, be sure that the needed validations are considered before the database update, to ensure that the database will not be update wrongly.</p>



<h2 class="wp-block-heading">Pipeline Result</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; title: ; notranslate">
trigger:
- none

pool:
  vmImage: windows-latest

variables:
  solution: &#039;**/*.sln&#039;
  buildPlatform: &#039;AnyCPU&#039;
  buildConfiguration: &#039;Release&#039;
  artifactName: &#039;artifacts&#039;
  environment: &#039;Development&#039;

- task: NuGetToolInstaller@1
  displayName: &#039;NuGet Installation&#039;

- task: NuGetCommand@2
  displayName: &#039;NuGet Restore&#039;
  inputs:
    restoreSolution: &#039;$(solution)&#039;

- task: VSBuild@1
  displayName: &#039;Build Project&#039;
  inputs:
    solution: &#039;backend/WebAPI&#039;
    msbuildArgs: &#039;/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation=&quot;$(build.artifactStagingDirectory)&quot;&#039;
    platform: &#039;$(buildPlatform)&#039;
    configuration: &#039;$(buildConfiguration)&#039;

- task: PublishSymbols@2
  displayName: &#039;Publish Symbols&#039;
  inputs:
    SearchPattern: &#039;**/bin/**/*.pdb&#039;
    SymbolServerType: &#039;FileShare&#039;
    CompressSymbols: false

- task: PublishBuildArtifacts@1
  displayName: &#039;Publish Artifacts&#039;
  inputs:
    PathtoPublish: &#039;$(Build.ArtifactStagingDirectory)&#039;
    ArtifactName: &#039;artifacts&#039;
    publishLocation: &#039;Container&#039;

- task: DownloadBuildArtifacts@0
  displayName: &#039;Build Artifacts&#039;
  inputs:
    buildType: &#039;current&#039;
    downloadType: &#039;single&#039;
    artifactName: &#039;$(artifactName)&#039;
    downloadPath: &#039;$(System.ArtifactsDirectory)&#039;

- task: DotNetCoreCLI@2
  displayName: &#039;Install EF tool&#039;
  inputs:
    command: &#039;custom&#039;
    custom: &#039;tool&#039;
    arguments: &#039;install --global dotnet-ef&#039;

- task: DotNetCoreCLI@2
  displayName: &#039;Generate SQL Script&#039;
  inputs:
    command: &#039;custom&#039;
    custom: &#039;ef&#039;
    arguments: &#039;migrations script --idempotent --project $(Build.SourcesDirectory)\Data.csproj --output $(System.ArtifactsDirectory)/script.sql&#039;

- task: SqlAzureDacpacDeployment@1
  displayName: &#039;Update Database&#039;
  inputs:
    azureSubscription: &#039;&lt;Service Connection Identifier&gt;&#039;
    AuthenticationType: &#039;connectionString&#039;
    ConnectionString: &#039;&lt;Connection String&gt;&#039;
    deployType: &#039;SqlTask&#039;
    SqlFile: &#039;$(System.ArtifactsDirectory)/script.sql&#039;

- task: AzureRmWebAppDeployment@4
  displayName: &#039;Deploy Application&#039;
  inputs:
    ConnectionType: &#039;AzureRM&#039;
    azureSubscription: &#039;&lt;Service Connection Identifier&gt;&#039;
    appType: &#039;webApp&#039;
    WebAppName: &#039;armazemlegalapi&#039;
    deployToSlotOrASE: true
    ResourceGroupName: &#039;&lt;Resource Group Identifier&gt;&#039;
    SlotName: &#039;production&#039;
    packageForLinux: &#039;$(System.ArtifactsDirectory)/Project.zip&#039;

- task: PublishBuildArtifacts@1
  displayName: &#039;Publish Artifacts&#039;
  inputs:
    PathtoPublish: &#039;$(System.ArtifactsDirectory)/script.sql&#039;
    ArtifactName: &#039;$(artifactName)&#039;
    publishLocation: &#039;Container&#039;
</pre></div>


<h2 class="wp-block-heading">References</h2>



<ul class="wp-block-list">
<li><a href="https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/applying?tabs=dotnet-core-cli#sql-scripts">Microsoft Managing Schemas Article</a></li>
</ul>
<p>The post <a href="https://blogit.create.pt/vini/2022/11/07/entity-framework-update-database-using-azure-pipelines/">Entity Framework &#8211; Update Database using Azure Pipelines</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/vini/2022/11/07/entity-framework-update-database-using-azure-pipelines/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SharePoint 2016 Upgrade: How to solve the “Feature is referenced in database but isn’t installed on the current farm” error</title>
		<link>https://blogit.create.pt/miguelisidoro/2018/09/16/sharepoint-farm-update-how-to-solve-the-feature-is-referenced-in-database-but-isnt-installed-on-the-current-farm-error-in-a-sharepoint-2016-farm/</link>
					<comments>https://blogit.create.pt/miguelisidoro/2018/09/16/sharepoint-farm-update-how-to-solve-the-feature-is-referenced-in-database-but-isnt-installed-on-the-current-farm-error-in-a-sharepoint-2016-farm/#comments</comments>
		
		<dc:creator><![CDATA[Miguel Isidoro]]></dc:creator>
		<pubDate>Sun, 16 Sep 2018 22:01:27 +0000</pubDate>
				<category><![CDATA[SharePoint 2016]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Migration]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[PSConfig]]></category>
		<category><![CDATA[Upgrade]]></category>
		<guid isPermaLink="false">https://blogit.create.pt/?p=7469</guid>

					<description><![CDATA[<p>Hello, Recently, I migrated a SharePoint 2010 farm to SharePoint 2016 and used an automated installation process using PowerShell and AutoSPInstaller to install the new SharePoint 2016 farm that ensured that the latest updates where applied, leaving the SharePoint 2016 farm updated and working properly (if you want to learn more about how to install a [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/miguelisidoro/2018/09/16/sharepoint-farm-update-how-to-solve-the-feature-is-referenced-in-database-but-isnt-installed-on-the-current-farm-error-in-a-sharepoint-2016-farm/">SharePoint 2016 Upgrade: How to solve the “Feature is referenced in database but isn’t installed on the current farm” error</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hello,</p>
<p>Recently, I migrated a SharePoint 2010 farm to SharePoint 2016 and used an automated installation process using PowerShell and <a href="https://autospinstaller.com/" target="_blank" rel="noopener noreferrer">AutoSPInstaller</a> to install the new SharePoint 2016 farm that ensured that the latest updates where applied, leaving the SharePoint 2016 farm updated and working properly (if you want to learn more about how to install a SharePoint farm in an automated way using PowerShell, I invite you to click <a href="https://blogit.create.pt////miguelisidoro/2018/07/28/how-to-install-a-sharepoint-2016-farm-using-powershell-and-autospinstaller-part-1/" target="_blank" rel="noopener noreferrer">here</a> and <a href="https://blogit.create.pt////miguelisidoro/2018/07/28/how-to-install-a-sharepoint-2016-farm-using-powershell-and-autospinstaller-part-2/" target="_blank" rel="noopener noreferrer">here)</a>.</p>
<p>After installing the farm and migrating the web applications, new updates were installed in the farm (if you want to keep up with the latest SharePoint updates, click <a href="https://buildnumbers.wordpress.com/sharepoint/" target="_blank" rel="noopener noreferrer">here</a>) but when I ran the SharePoint Products and Configuration Wizard to ensure the new updates were properly installed (to know more about the need to run SharePoint Products and Configuration Wizard after a SharePoint farm update, click <a href="https://blogs.technet.microsoft.com/stefan_gossner" target="_blank" rel="noopener noreferrer">here</a>), I got an error that was preventing me to finish the update process.</p>
<p><strong>Important Note:</strong> Both source SharePoint 2010 and target SharePoint 2016 farms have Standard SharePoint licenses.</p>
<h1>The Problem</h1>
<p>After installing the updates and after running the SharePoint Products and Configuration, I was getting the following error:</p>
<p><img fetchpriority="high" decoding="async" class="alignnone wp-image-7478 size-full" src="https://blogit.create.pt////wp-content/uploads/2018/09/SP2016_PSConfig_Error.jpg" alt="" width="621" height="536" srcset="https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_PSConfig_Error.jpg 621w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_PSConfig_Error-300x259.jpg 300w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_PSConfig_Error-534x462.jpg 534w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_PSConfig_Error-487x420.jpg 487w" sizes="(max-width: 621px) 100vw, 621px" /></p>
<p>The error details:</p>
<p><i>An exception of type Microsoft.SharePoint.PostSetupConfiguration.PostSetupConfigurationTaskException was thrown.  Additional exception information: </i></p>
<p><i>Feature (Name = [SharePoint Portal Server Status Indicator List template], Id = [065c78be-5231-477e-a972-14177cc5b3c7], Description = [SharePoint Portal Server Status Indicator List template], Install Location = </i><i><strong>[BizAppsListTemplates]) is referenced in database [Content_DB]</strong>, <strong>but isn&#8217;t installed on the current farm</strong></i><i>. The missing feature might cause upgrade to fail. If necessary, please install any solution that contains the feature and restart upgrade.        (EventID:ajxkh)</i></p>
<p><i>Feature (Name = [SharePoint Server Enterprise Site Features], Id = [0806d127-06e6-447a-980e-2e90b03101b8], Description = [<strong>Features such as the Visio Services, Access Services, and Excel Services applications included in the SharePoint Server Enterprise License.</strong>], </i><i>Install Location = <strong>[PremiumWeb]) is referenced in database Content_DB] but isn&#8217;t installed on the current farm</strong></i><i>. The missing feature might cause upgrade to fail. If necessary, please install any solution that contains the feature and restart upgrade.        (EventID:ajxkh)</i></p>
<p><i>Feature (Name = [SharePoint Portal Server Report Library], Id = [2510d73f-7109-4ccc-8a1c-314894deeb3a], Description = [SharePoint Portal Server Report Library], Install Location = </i><strong><i>[ReportListTemplate]) is referenced in database [Content_DB], but isn&#8217;t installed on the current farm</i></strong><i>. The missing feature might cause upgrade to fail. If necessary, please install any solution that contains the feature and restart upgrade.        (EventID:ajxkh)</i></p>
<p><i>Feature (Name = [InfoPath Forms Services Support], Id = [c88c4ff1-dbf5-4649-ad9f-c6c426ebcbf5], Description = </i><i>[InfoPath Forms Services Lists and Related Pages to Enable Presentation of Forms on the Server.], Install Location = [<strong>IPFSSiteFeatures]) is referenced in database Content_DB], but isn&#8217;t installed on the current farm</strong></i><i>. The missing feature might cause upgrade to fail. If necessary, please install any solution that contains the feature and restart upgrade.        (EventID:ajxkh)</i></p>
<p><i>Feature (Name = [Data Connections Feature], Id = [00bfea71-dbd7-4f72-b8cb-da7ac0440130], Description = [], Install Location = </i><strong><i>[DataConnectionLibrary]) is referenced in database Content_DB], but isn&#8217;t installed on the current farm</i></strong><i>. The missing feature might cause upgrade to fail. If necessary, please install any solution that contains the feature and restart upgrade.        (EventID:ajxkh)</i></p>
<p><i>Upgrade [SPContentDatabase Name=Content_DB] failed.        (EventID:an59t)</i></p>
<p><i>Exception: <strong>The upgraded database schema doesn&#8217;t match the TargetSchema</strong></i><i><strong>  </strong>      (EventID:an59t)</i></p>
<p><i>Upgrade Timer job is exiting due to exception: </i><i>Microsoft.SharePoint.Upgrade.SPUpgradeException: <strong>The upgraded database schema doesn&#8217;t match the TargetSchema</strong></i></p>
<p>There are two main problems here:</p>
<ul>
<li>There are references in the content database to SharePoint Enterprise Features (InfoPath Form Services, Visio Services, Excel Services, etc) &#8211; my guess here is that sometime along the way, the source SharePoint 2010 farm had an Enterprise SharePoint license and was downgraded to a Standard license, leaving behind however references to Enterprise features in the content database</li>
<li>There is a mismatch between the content database schema version and the version of SharePoint updates installed in the farm</li>
</ul>
<p>One additional symptom that confirms there is an upgrade issue is the Upgrade Status page in Central Administration that showed the upgrade status as Failed:</p>
<p><img decoding="async" class="alignnone wp-image-7480 size-full" src="https://blogit.create.pt////wp-content/uploads/2018/09/SP2016_Upgrade_Status_Error.jpg" alt="" width="1581" height="469" srcset="https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Upgrade_Status_Error.jpg 1581w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Upgrade_Status_Error-300x89.jpg 300w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Upgrade_Status_Error-768x228.jpg 768w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Upgrade_Status_Error-1024x304.jpg 1024w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Upgrade_Status_Error-696x206.jpg 696w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Upgrade_Status_Error-1068x317.jpg 1068w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Upgrade_Status_Error-1416x420.jpg 1416w" sizes="(max-width: 1581px) 100vw, 1581px" /></p>
<h1>The Solution</h1>
<p>The solution to this problem was a two part solution, both applied in the target SharePoint 2016 farm:</p>
<ul>
<li>Fixing the missing Enterprise features references in the content database</li>
<li>Fixing the content database schema version mismatch</li>
</ul>
<h2>Fixing the missing Enterprise features references in the content database</h2>
<p>To fix the problem with references to Enterprise SharePoint features, I used the <a href="https://github.com/achimismaili/featureadmin" target="_blank" rel="noopener noreferrer">SharePoint Feature Administration and Clean Up Tool</a>, which basically enables us to delete from the Farm, Web Application, Site Collection and sub sites any references to features that are not installed in the farm. The version I used was the version 2.4.8 that you can download <a href="https://github.com/achimismaili/featureadmin/raw/master/Releases/Sp2010/2.4.8/FeatureAdmin2010.zip" target="_blank" rel="noopener noreferrer">here</a>, that supports SharePoint 2016. The version 3.0, for some reason, didn&#8217;t detect the farm, which made it useless (maybe a beta version, not sure).</p>
<p>In this case, to remove the missing feature references, I used the SharePoint Feature Administration and Clean Up Tool to:</p>
<ul>
<li>Remove the missing features from the farm</li>
<li>Remove the missing features from the sub sites</li>
</ul>
<p>First, I removed the missing features from the farm, by removing the features marked as &#8220;Faulty&#8221; in the &#8220;Farm Feature Administration&#8221; tab, using the <strong>&#8220;Uninstall&#8221;</strong> button for each missing feature.</p>
<p><img decoding="async" class="alignnone size-full wp-image-7476" src="https://i2.wp.com/blogit.create.pt/wp-content/uploads/2018/09/SP2016_FeatureAdmin_Farm_Features_Error.jpg" alt="" width="1143" height="738" srcset="https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_FeatureAdmin_Farm_Features_Error.jpg 1143w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_FeatureAdmin_Farm_Features_Error-300x194.jpg 300w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_FeatureAdmin_Farm_Features_Error-768x496.jpg 768w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_FeatureAdmin_Farm_Features_Error-1024x661.jpg 1024w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_FeatureAdmin_Farm_Features_Error-696x449.jpg 696w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_FeatureAdmin_Farm_Features_Error-1068x690.jpg 1068w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_FeatureAdmin_Farm_Features_Error-650x420.jpg 650w" sizes="(max-width: 1143px) 100vw, 1143px" /></p>
<p>After that, I removed the features marked as ERROR in the &#8220;Remove / deactivate features in the selected sites&#8221; tab, by selecting all the site collection faulty features and using the <strong>&#8220;Remove from selected SiteCollection&#8221;</strong> button.</p>
<p>Finally, for each site, I selected the faulty site features and removed them by using the <strong>&#8220;Remove from selected Site (SPWeb)&#8221;</strong> button.</p>
<p><img decoding="async" class="alignnone size-full wp-image-7477" src="https://blogit.create.pt////wp-content/uploads/2019/05/SP2016_FeatureAdmin_SiteCollection_Site_Features_Error.jpg" alt="" width="1182" height="672" /></p>
<h2>Fixing the content database schema version mismatch</h2>
<p>To fix the version mismatch between the content database schema version and the version of installed SharePoint updates, I executed the following PowerShell command (executed with &#8220;run as administrator&#8221;):</p>
<p><strong>Get-SPContentDatabase | Upgrade-SPContentDatabase</strong></p>
<p>After this, I ran the SharePoint Products and Configuration Wizard again, and this time, it ran successfully:</p>
<p><img decoding="async" class="alignnone size-full wp-image-7479" src="https://blogit.create.pt////wp-content/uploads/2018/09/SP2016_PSConfig_Success.jpg" alt="" width="617" height="535" srcset="https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_PSConfig_Success.jpg 617w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_PSConfig_Success-300x260.jpg 300w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_PSConfig_Success-534x462.jpg 534w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_PSConfig_Success-484x420.jpg 484w" sizes="(max-width: 617px) 100vw, 617px" /></p>
<p>To confirm if everything was OK, I checked the following pages in Central Administration in the target SharePoint 2016 farm:</p>
<ul>
<li>The Upgrade Status page</li>
<li>The Database Upgrade Status page</li>
</ul>
<p>In the Upgrade Status page, there is now a Succeeded upgrade status:</p>
<p><img decoding="async" class="alignnone size-full wp-image-7481" src="https://blogit.create.pt////wp-content/uploads/2018/09/SP2016_Upgrade_Status_Success.jpg" alt="" width="1441" height="624" srcset="https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Upgrade_Status_Success.jpg 1441w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Upgrade_Status_Success-300x130.jpg 300w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Upgrade_Status_Success-768x333.jpg 768w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Upgrade_Status_Success-1024x443.jpg 1024w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Upgrade_Status_Success-696x301.jpg 696w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Upgrade_Status_Success-1068x462.jpg 1068w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Upgrade_Status_Success-970x420.jpg 970w" sizes="(max-width: 1441px) 100vw, 1441px" /></p>
<p>In the Database Upgrade Status page, there is an indication of &#8220;No action required&#8221; for all content databases in the farm, meaning that all databases were properly upgraded and the respective schema version is the same as the installed SharePoint updates:</p>
<p><img decoding="async" class="alignnone size-full wp-image-7475" src="https://blogit.create.pt////wp-content/uploads/2018/09/SP2016_Database_Upgrade_Status_Success.jpg" alt="" width="1408" height="561" srcset="https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Database_Upgrade_Status_Success.jpg 1408w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Database_Upgrade_Status_Success-300x120.jpg 300w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Database_Upgrade_Status_Success-768x306.jpg 768w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Database_Upgrade_Status_Success-1024x408.jpg 1024w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Database_Upgrade_Status_Success-696x277.jpg 696w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Database_Upgrade_Status_Success-1068x426.jpg 1068w, https://blogit.create.pt/wp-content/uploads/2018/09/SP2016_Database_Upgrade_Status_Success-1054x420.jpg 1054w" sizes="(max-width: 1408px) 100vw, 1408px" /></p>
<p>Hope this helps!</p>
<h1>Related Articles</h1>
<p>To learn why your business should migrate to SharePoint Online and Office 365, click <a href="https://blogit.create.pt////miguelisidoro/2019/07/29/why-your-business-should-migrate-to-sharepoint-online-and-office-365-the-value-offer-part-1/" target="_blank" rel="noreferrer noopener">here</a> and <a href="https://blogit.create.pt////miguelisidoro/2019/07/29/why-your-business-should-migrate-to-sharepoint-online-and-office-365-the-value-offer-part-2/" target="_blank" rel="noreferrer noopener">here</a>.</p>
<p>If you want to convert your tenant&#8217;s root classic site into a modern SharePoint site, click <a href="https://blogit.create.pt////miguelisidoro/2019/08/27/how-to-modernize-your-tenant-root-site-collection-in-office-365-using-invoke-spositeswap/" target="_blank" rel="noreferrer noopener">here</a>.</p>
<p>In the meantime, SharePoint 2019 RTM is already out there! If you want to know all about the new features available in the new SharePoint Server release, click <a href="https://blogit.create.pt////miguelisidoro/2018/11/01/meet-the-new-modern-sharepoint-server-sharepoint-2019-rtm-is-here/" target="_blank" rel="noopener noreferrer">here</a>.</p>
<p>If you are a SharePoint administrator or a SharePoint developer who wants to learn more about how to install a SharePoint 2019 farm in an automated way using PowerShell, I invite you to click <a href="https://blogit.create.pt////miguelisidoro/2018/12/09/how-to-install-a-sharepoint-2019-farm-using-powershell-and-autospinstaller-part-1/" target="_blank" rel="noopener noreferrer">here</a> and <a href="https://blogit.create.pt////miguelisidoro/2018/12/09/how-to-install-a-sharepoint-2019-farm-using-powershell-and-autospinstaller-part-2/" target="_blank" rel="noopener noreferrer">here</a>.</p>
<p>If you want to learn how to upgrade a SharePoint 2013 farm to SharePoint 2019, click <a href="https://blogit.create.pt////miguelisidoro/2019/03/06/how-to-upgrade-from-sharepoint-2013-to-sharepoint-2019-step-by-step-part-1/" target="_blank" rel="noreferrer noopener">here </a>and <a href="https://blogit.create.pt////miguelisidoro/2019/03/06/how-to-upgrade-from-sharepoint-2013-to-sharepoint-2019-step-by-step-part-2/" target="_blank" rel="noreferrer noopener">here</a>.</p>
<p>If you want to learn all the steps and precautions necessary to successfully keep your SharePoint farm updated and be ready to start your move to the cloud, click <a href="https://blogit.create.pt////miguelisidoro/2019/04/08/how-to-install-sharepoint-cumulative-updates-in-a-sharepoint-farm-step-by-step/" target="_blank" rel="noreferrer noopener">here</a>.</p>
<p>If you learn how to greatly speed up your SharePoint farm update process to ensure your SharePoint farm keeps updated and you stay one step closer to start your move to the cloud, click <a href="https://blogit.create.pt////miguelisidoro/2019/05/02/how-to-speed-up-the-installation-of-sharepoint-cumulative-updates-using-powershell-step-by-step/" target="_blank" rel="noreferrer noopener" aria-label="here (opens in a new tab)">here</a>.</p>
<p>If SharePoint 2019 is still not an option, you can learn more about how to install a SharePoint 2016 farm in an automated way using PowerShell, click <a href="https://blogit.create.pt////miguelisidoro/2018/07/28/how-to-install-a-sharepoint-2016-farm-using-powershell-and-autospinstaller-part-1/" target="_blank" rel="noreferrer noopener">here</a> and <a href="https://blogit.create.pt////miguelisidoro/2018/07/28/how-to-install-a-sharepoint-2016-farm-using-powershell-and-autospinstaller-part-2/" target="_blank" rel="noreferrer noopener">here</a>.</p>
<p>If you are involved in a SharePoint upgrade and want to learn more about the upgrade process, click <a href="https://blogit.create.pt////miguelisidoro/2019/02/04/sharepoint-upgrade-upgrading-a-sharepoint-2010-farm-to-sharepoint-2016-step-by-step-part-1/" target="_blank" rel="noreferrer noopener">here </a>and <a href="https://blogit.create.pt////miguelisidoro/2019/02/04/sharepoint-upgrade-upgrading-a-sharepoint-2010-farm-to-sharepoint-2016-step-by-step-part-2/" target="_blank" rel="noreferrer noopener">here</a>.</p>
<p>If you are new to SharePoint and Office 365 and want to learn all about it, take a look at these <a href="https://blogit.create.pt////miguelisidoro/2018/10/17/sharepoint-and-office-365-learning-resources/" target="_blank" rel="noopener noreferrer">learning resources</a>.</p>
<p>If you are work in a large organization who is using Office 365 or thinking to move to Office 365 and is considering between a single or multiple Office 365 tenants, I invite you to read <a href="https://blogit.create.pt////miguelisidoro/2019/01/07/pros-and-cons-of-single-tenant-vs-multiple-tenants-in-office-365/" target="_blank" rel="noreferrer noopener">this article</a>.</p>
<p>If you want to know all about the latest SharePoint and Office 365 announcements from SharePoint Conference 2019, click <a href="https://blogit.create.pt////miguelisidoro/2019/06/05/whats-new-for-sharepoint-and-office-365-from-sharepoint-conference-2019-part-1/" target="_blank" rel="noreferrer noopener">here </a>and <a href="https://blogit.create.pt////miguelisidoro/2019/06/05/whats-new-for-sharepoint-and-office-365-from-sharepoint-conference-2019-part-2/" target="_blank" rel="noreferrer noopener">here</a>.</p>
<p>Happy SharePointing!</p>
<p>The post <a href="https://blogit.create.pt/miguelisidoro/2018/09/16/sharepoint-farm-update-how-to-solve-the-feature-is-referenced-in-database-but-isnt-installed-on-the-current-farm-error-in-a-sharepoint-2016-farm/">SharePoint 2016 Upgrade: How to solve the “Feature is referenced in database but isn’t installed on the current farm” error</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/miguelisidoro/2018/09/16/sharepoint-farm-update-how-to-solve-the-feature-is-referenced-in-database-but-isnt-installed-on-the-current-farm-error-in-a-sharepoint-2016-farm/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>SharePoint Tip #27: Choice Columns and DataSheet Views</title>
		<link>https://blogit.create.pt/andrevala/2011/10/30/sharepoint-tip-27-choice-columns-and-datasheet-views/</link>
					<comments>https://blogit.create.pt/andrevala/2011/10/30/sharepoint-tip-27-choice-columns-and-datasheet-views/#respond</comments>
		
		<dc:creator><![CDATA[André Vala]]></dc:creator>
		<pubDate>Sun, 30 Oct 2011 17:09:19 +0000</pubDate>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[SharePoint]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/andrevala/?p=221</guid>

					<description><![CDATA[<p>Using features to create Choice site columns is pretty straightforward (check this post for additional information). See below a sample feature element for that purpose. &#60;Field &#160;&#160;&#160; ID=&#34;{538c71e4-8650-4ce7-b021-920effa66346}&#34; &#160;&#160;&#160; Type=&#34;Choice&#34; &#160;&#160;&#160; Name=&#34;Publishing_x0020_Status&#34; &#160;&#160;&#160; StaticName=&#34;Publishing_x0020_Status&#34; &#160;&#160;&#160; DisplayName=&#34;Publishing Status&#34; &#160;&#160;&#160; Required=&#34;FALSE&#34;&#160; &#160;&#160;&#160; Format=&#34;Dropdown&#34; &#160;&#160;&#160; FillInChoice=&#34;FALSE&#34; &#160;&#160;&#160; Group=&#34;Custom Columns&#34;&#62; &#160;&#160;&#160; &#60;Default&#62;Not Published&#60;/Default&#62; &#160;&#160;&#160; &#60;CHOICES&#62; &#160;&#160;&#160;&#160;&#160;&#160; &#60;CHOICE&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Not [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/andrevala/2011/10/30/sharepoint-tip-27-choice-columns-and-datasheet-views/">SharePoint Tip #27: Choice Columns and DataSheet Views</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Using features to create <strong>Choice</strong> site columns is pretty straightforward (check <a href="http://blogit.create.pt/blogs/andrevala/archive/2008/03/26/SharePoint-2007-Deployment_3A00_-Site-Column-Features.aspx" target="_blank">this post</a> for additional information). See below a sample feature element for that purpose.</p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&lt;</font></font></span><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#a31515">Field </font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#a31515"><font style="font-size: 10pt">&#160;&#160;&#160; </font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#ff0000">ID</font></span><span style="font-family:;color:" lang="EN"><font color="#0000ff">=</font></span></font><span style="font-family:" lang="EN"><font style="font-size: 10pt">&quot;<span style="color:"><font color="#0000ff">{538c71e4-8650-4ce7-b021-920effa66346}</font></span>&quot;</font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160; <span style="color:"><font color="#ff0000">Type</font></span><span style="color:"><font color="#0000ff">=</font></span>&quot;<span style="color:"><font color="#0000ff">Choice</font></span>&quot;</font></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160; <span style="color:"><font color="#ff0000">Name</font></span><span style="color:"><font color="#0000ff">=</font></span>&quot;<span style="color:"><font color="#0000ff">Publishing_x0020_Status</font></span>&quot;</font></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160; <span style="color:"><font color="#ff0000">StaticName</font></span><span style="color:"><font color="#0000ff">=</font></span>&quot;<span style="color:"><font color="#0000ff">Publishing_x0020_Status</font></span>&quot;</font></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160; <span style="color:"><font color="#ff0000">DisplayName</font></span><span style="color:"><font color="#0000ff">=</font></span>&quot;<span style="color:"><font color="#0000ff">Publishing Status</font></span>&quot;</font></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160; <span style="color:"><font color="#ff0000">Required</font></span><span style="color:"><font color="#0000ff">=</font></span>&quot;<span style="color:"><font color="#0000ff">FALSE</font></span>&quot;&#160; </font></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160; <span style="color:"><font color="#ff0000">Format</font></span><span style="color:"><font color="#0000ff">=</font></span>&quot;<span style="color:"><font color="#0000ff">Dropdown</font></span>&quot;</font></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160; <span style="color:"><font color="#ff0000">FillInChoice</font></span><span style="color:"><font color="#0000ff">=</font></span>&quot;<span style="color:"><font color="#0000ff">FALSE</font></span>&quot;</font></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160; <span style="color:"><font color="#ff0000">Group</font></span><span style="color:"><font color="#0000ff">=</font></span>&quot;<span style="color:"><font color="#0000ff">Custom Columns</font></span>&quot;</font><span style="color:"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160; &lt;</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">Default</font></span><span style="font-family:;color:" lang="EN"><font color="#0000ff">&gt;</font></span></font><span style="font-family:" lang="EN"><font style="font-size: 10pt">Not Published<span style="color:"><font color="#0000ff">&lt;/</font></span><span style="color:"><font color="#a31515">Default</font></span></font><span style="color:"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160; &lt;</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">CHOICES</font></span></font><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160; &lt;</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">CHOICE</font></span></font><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></font></span><span style="font-family:" lang="EN"><font style="font-size: 10pt">Not Published</font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160; &lt;/</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">CHOICE</font></span></font><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160; &lt;</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">CHOICE</font></span></font><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></font></span><span style="font-family:" lang="EN"><font style="font-size: 10pt">Pending</font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:"><font color="#0000ff">&lt;/</font></span><span style="color:"><font color="#a31515">CHOICE</font></span></font><span style="color:"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160; &lt;</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">CHOICE</font></span></font><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></font></span><span style="font-family:" lang="EN"><font style="font-size: 10pt">Published</font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:"><font color="#0000ff">&lt;/</font></span><span style="color:"><font color="#a31515">CHOICE</font></span></font><span style="color:"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160; &lt;</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">CHOICE</font></span></font><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></font></span><span style="font-family:" lang="EN"><font style="font-size: 10pt">Error</font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:"><font color="#0000ff">&lt;/</font></span><span style="color:"><font color="#a31515">CHOICE</font></span></font><span style="color:"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160; &lt;/</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">CHOICES</font></span></font><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&lt;/</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">Field</font></span></font><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></p>
<p>Although the XML is well formed and all the attributes and values are correct, this field definition has a problem. If you create a site column using this definition, here is what happens:</p>
<ul>
<li>If you check the site column configuration in SharePoint, everything will look fine</li>
<li>If you add this site column to a list (either through a content type, or directly) and you edit an item using the default list forms, everything will work as expected.</li>
<li>If you try to edit the list items using a <strong>DataSheet View</strong>, you won’t be able to select any value from this choice field and SharePoint will always throw a validation error.</li>
</ul>
<p>The problem here are the invisible characters (spaces, newlines and tabs) between the <span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&lt;</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">CHOICE</font></span></font><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span> and <span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt"><span style="color:"><font color="#0000ff">&lt;/</font></span><span style="color:"><font color="#a31515">CHOICE</font></span></font><span style="color:"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></span> tags and their inner values. Apparently, when using list forms these characters are trimmed from the valid choices, but when using the datasheet view they are not, causing a strange behavior when editing an item in that view.</p>
<p>The correct definition for this field would be:</p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&lt;</font></font></span><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#a31515">Field </font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#a31515"><font style="font-size: 10pt">&#160;&#160;&#160; </font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#ff0000">ID</font></span><span style="font-family:;color:" lang="EN"><font color="#0000ff">=</font></span></font><span style="font-family:" lang="EN"><font style="font-size: 10pt">&quot;<span style="color:"><font color="#0000ff">{538c71e4-8650-4ce7-b021-920effa66346}</font></span>&quot;</font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160; <span style="color:"><font color="#ff0000">Type</font></span><span style="color:"><font color="#0000ff">=</font></span>&quot;<span style="color:"><font color="#0000ff">Choice</font></span>&quot;</font></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160; <span style="color:"><font color="#ff0000">Name</font></span><span style="color:"><font color="#0000ff">=</font></span>&quot;<span style="color:"><font color="#0000ff">Publishing_x0020_Status</font></span>&quot;</font></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160; <span style="color:"><font color="#ff0000">StaticName</font></span><span style="color:"><font color="#0000ff">=</font></span>&quot;<span style="color:"><font color="#0000ff">Publishing_x0020_Status</font></span>&quot;</font></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160; <span style="color:"><font color="#ff0000">DisplayName</font></span><span style="color:"><font color="#0000ff">=</font></span>&quot;<span style="color:"><font color="#0000ff">Publishing Status</font></span>&quot;</font></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160; <span style="color:"><font color="#ff0000">Required</font></span><span style="color:"><font color="#0000ff">=</font></span>&quot;<span style="color:"><font color="#0000ff">FALSE</font></span>&quot;&#160; </font></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160; <span style="color:"><font color="#ff0000">Format</font></span><span style="color:"><font color="#0000ff">=</font></span>&quot;<span style="color:"><font color="#0000ff">Dropdown</font></span>&quot;</font></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160; <span style="color:"><font color="#ff0000">FillInChoice</font></span><span style="color:"><font color="#0000ff">=</font></span>&quot;<span style="color:"><font color="#0000ff">FALSE</font></span>&quot;</font></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt">&#160;&#160;&#160; <span style="color:"><font color="#ff0000">Group</font></span><span style="color:"><font color="#0000ff">=</font></span>&quot;<span style="color:"><font color="#0000ff">Custom Columns</font></span>&quot;</font><span style="color:"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160; &lt;</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">Default</font></span><span style="font-family:;color:" lang="EN"><font color="#0000ff">&gt;</font></span></font><span style="font-family:" lang="EN"><font style="font-size: 10pt">Not Published<span style="color:"><font color="#0000ff">&lt;/</font></span><span style="color:"><font color="#a31515">Default</font></span></font><span style="color:"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160; &lt;</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">CHOICES</font></span></font><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160; &lt;</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">CHOICE</font></span></font><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font><font face="Courier New"><span style="font-family:" lang="EN"><font style="font-size: 10pt">Not Published</font></span></font><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&lt;/</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">CHOICE</font></span></font><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160; &lt;</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">CHOICE</font></span></font><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font><font face="Courier New"><span style="font-family:" lang="EN"><font style="font-size: 10pt">Pending</font></span></font><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt"><span style="color:"><font color="#0000ff">&lt;/</font></span><span style="color:"><font color="#a31515">CHOICE</font></span></font><span style="color:"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160; &lt;</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">CHOICE</font></span></font><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font><font face="Courier New"><span style="font-family:" lang="EN"><font style="font-size: 10pt">Published</font></span></font><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt"><span style="color:"><font color="#0000ff">&lt;/</font></span><span style="color:"><font color="#a31515">CHOICE</font></span></font><span style="color:"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160;&#160;&#160;&#160; &lt;</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">CHOICE</font></span></font><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font><font face="Courier New"><span style="font-family:" lang="EN"><font style="font-size: 10pt">Error</font></span></font><span style="font-family:" lang="EN"><font face="Courier New"><font style="font-size: 10pt"><span style="color:"><font color="#0000ff">&lt;/</font></span><span style="color:"><font color="#a31515">CHOICE</font></span></font><span style="color:"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&#160;&#160;&#160; &lt;/</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">CHOICES</font></span></font><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><font face="Courier New"><span style="font-family:;color:" lang="EN"><font color="#0000ff"><font style="font-size: 10pt">&lt;/</font></font></span><font style="font-size: 10pt"><span style="font-family:;color:" lang="EN"><font color="#a31515">Field</font></span></font><span style="font-family:;color:" lang="EN"><font style="font-size: 10pt" color="#0000ff">&gt;</font></span></font></p>
<p>The post <a href="https://blogit.create.pt/andrevala/2011/10/30/sharepoint-tip-27-choice-columns-and-datasheet-views/">SharePoint Tip #27: Choice Columns and DataSheet Views</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/andrevala/2011/10/30/sharepoint-tip-27-choice-columns-and-datasheet-views/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SharePoint Tip #26: Comments in Content Type Definition</title>
		<link>https://blogit.create.pt/andrevala/2011/08/06/sharepoint-tip-26-comments-in-content-type-definition/</link>
					<comments>https://blogit.create.pt/andrevala/2011/08/06/sharepoint-tip-26-comments-in-content-type-definition/#respond</comments>
		
		<dc:creator><![CDATA[André Vala]]></dc:creator>
		<pubDate>Sat, 06 Aug 2011 16:33:56 +0000</pubDate>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[SharePoint]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/andrevala/?p=241</guid>

					<description><![CDATA[<p>There is an issue with SharePoint 2010’s CAML parser that causes SharePoint to ignore fields in a Content Type definition. When defining a Content Type feature element, avoid placing comments inside the &#60;fieldrefs&#62; element as that will cause SharePoint to create the Content Type disregarding all the fields, even though the XML is well formed. [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/andrevala/2011/08/06/sharepoint-tip-26-comments-in-content-type-definition/">SharePoint Tip #26: Comments in Content Type Definition</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>There is an issue with SharePoint 2010’s CAML parser that causes SharePoint to ignore fields in a Content Type definition. When defining a Content Type feature element, avoid placing comments inside the <code>&lt;fieldrefs&gt;</code> element as that will cause SharePoint to create the Content Type disregarding all the fields, even though the XML is well formed.</p>
<p><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;      <br />&lt;Elements xmlns=&quot;http://schemas.microsoft.com/sharepoint/&quot;&gt;       <br />&#160; &lt;ContentType       <br />&#160;&#160;&#160; ID=&quot;0x0100C5647A362F236548B218C15302286758&quot;       <br />&#160;&#160;&#160; Name=&quot;MyCT&quot;       <br />&#160;&#160;&#160; Description=&quot;Simple Custom Content Type&quot;&#160; <br />&#160;&#160;&#160; Inherits=&quot;TRUE&quot;       <br />&#160;&#160;&#160; Overwrite=&quot;TRUE&quot;       <br />&#160;&#160;&#160; Version=&quot;0&quot;&gt;       <br />&#160;&#160;&#160; &lt;Folder TargetName=”_cts/MyCT” /&gt;       <br />&#160;&#160;&#160; <strong>&lt;FieldRefs&gt;</strong>       <br />&#160;&#160;&#160;&#160;&#160; &lt;FieldRef ID=&quot;{fa564e0f-0c70-4ab9-b863-0177e6ddd247}&quot; Name=&quot;Title&quot; /&gt;       </p>
<p>&#160;&#160;&#160;&#160;&#160; <strong><font color="#ff0000">&lt;!-- This is a comment –-&gt;</font></strong>&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160; &lt;FieldRef ID=&quot;{b402db15-ee44-4ec4-89e3-23e10a8fc64c}&quot; Name=&quot;My_x0200_Field&quot; /&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;FieldRef ID=&quot;{538c71e4-8650-4ce7-b021-920effa66346}&quot; Name=&quot;Status&quot; /&gt;       <br />&#160;&#160;&#160; <strong>&lt;/FieldRefs&gt;</strong>       <br />&#160; &lt;/ContentType&gt;       <br />&lt;/Elements&gt; </code></p>
<p>The Content Type feature element above will cause the Content Type to be created with only the Title field, which is inherited from the parent Content Type. All the fields referenced in this Content Type definition will be ignored.</p>
<p>The post <a href="https://blogit.create.pt/andrevala/2011/08/06/sharepoint-tip-26-comments-in-content-type-definition/">SharePoint Tip #26: Comments in Content Type Definition</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/andrevala/2011/08/06/sharepoint-tip-26-comments-in-content-type-definition/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Adding an Assembly to Safe Controls in SharePoint Tools for Visual Studio 2010</title>
		<link>https://blogit.create.pt/andrevala/2010/08/22/adding-an-assembly-to-safe-controls-in-sharepoint-tools-for-visual-studio-2010/</link>
					<comments>https://blogit.create.pt/andrevala/2010/08/22/adding-an-assembly-to-safe-controls-in-sharepoint-tools-for-visual-studio-2010/#comments</comments>
		
		<dc:creator><![CDATA[André Vala]]></dc:creator>
		<pubDate>Sun, 22 Aug 2010 17:42:46 +0000</pubDate>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/andrevala/?p=361</guid>

					<description><![CDATA[<p>Using SharePoint Tools for Visual Studio 2010 allows you to build SharePoint solution packages very easily. When you create a SharePoint project, Visual Studio allows you to specify if the assembly for that project should be included in the package and, in case it does, where you want it to be deployed to. By default, [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/andrevala/2010/08/22/adding-an-assembly-to-safe-controls-in-sharepoint-tools-for-visual-studio-2010/">Adding an Assembly to Safe Controls in SharePoint Tools for Visual Studio 2010</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Using <strong>SharePoint Tools for Visual Studio 2010</strong> allows you to build SharePoint solution packages very easily. When you create a SharePoint project, Visual Studio allows you to specify if the assembly for that project should be included in the package and, in case it does, where you want it to be deployed to.</p>
<p>By default, the assembly is included in the package and is deployed to the Global Assembly Cache. You can change both configurations by clicking on the project in <strong>Solution Explorer</strong> and editing the properties on the <strong>Properties</strong> window.</p>
<p><a href="http://img828.imageshack.us/img828/1397/sharepointprojectprops.jpg" target="_blank"><img decoding="async" border="0" alt="SharePoint Properties Window" src="http://img828.imageshack.us/img828/1397/sharepointprojectprops.jpg"> </a></p>
<p>However, there is no project property that allows you to specify you want to add the assembly to the Safe Controls section on the web application configuration file. To do this, follow the steps below:</p>
<p>1. On Solution Explorer, click on the project    <br />2. On the Properties window, specify you don’t want the assembly to be included in the package (set <strong>Include Assembly in Package</strong> as <strong>False</strong>)</p>
<p><a href="http://img580.imageshack.us/img580/5227/addassemblysafecontrols.jpg" target="_blank"><img decoding="async" border="0" alt="Add Assembly to Safe Controls - 1,2" src="http://img580.imageshack.us/img580/5227/addassemblysafecontrols.jpg" width="700"> </a></p>
<p>3. On Solution Explorer, double-click the Package folder to open the Package editor    <br />4. On the Package Editor, click the <strong>Advanced</strong> button (bottom of the screen)</p>
<p><a href="http://img405.imageshack.us/img405/5227/addassemblysafecontrols.jpg" target="_blank"><img decoding="async" border="0" alt="Add Assembly to Safe Controls - 3,4" src="http://img405.imageshack.us/img405/5227/addassemblysafecontrols.jpg" width="700"> </a></p>
<p>5. Click the <strong>Add</strong> button     <br />6. Select <strong>Add</strong> <strong>Assembly from Project Output…</strong></p>
<p><a href="http://img405.imageshack.us/img405/518/addassemblysafecontrolsd.jpg" target="_blank"><img decoding="async" border="0" alt="Add Assembly to Safe Controls - 5,6" src="http://img405.imageshack.us/img405/518/addassemblysafecontrolsd.jpg" width="700"> </a></p>
<p>7. Select the current project (which contains the package)    <br />8. Add the safe controls information</p>
<p><a href="http://img844.imageshack.us/img844/5227/addassemblysafecontrols.jpg" target="_blank"><img decoding="async" border="0" alt="Add Assembly to Safe Controls - 7,8" src="http://img844.imageshack.us/img844/5227/addassemblysafecontrols.jpg" width="700"> </a></p>
<p>The post <a href="https://blogit.create.pt/andrevala/2010/08/22/adding-an-assembly-to-safe-controls-in-sharepoint-tools-for-visual-studio-2010/">Adding an Assembly to Safe Controls in SharePoint Tools for Visual Studio 2010</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/andrevala/2010/08/22/adding-an-assembly-to-safe-controls-in-sharepoint-tools-for-visual-studio-2010/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Renaming a Feature in SharePoint Tools for Visual Studio 2010</title>
		<link>https://blogit.create.pt/andrevala/2010/08/21/renaming-a-feature-in-sharepoint-tools-for-visual-studio-2010/</link>
					<comments>https://blogit.create.pt/andrevala/2010/08/21/renaming-a-feature-in-sharepoint-tools-for-visual-studio-2010/#respond</comments>
		
		<dc:creator><![CDATA[André Vala]]></dc:creator>
		<pubDate>Sat, 21 Aug 2010 18:28:12 +0000</pubDate>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/andrevala/?p=381</guid>

					<description><![CDATA[<p>If you’ve created SharePoint projects using SharePoint Tools for Visual Studio 2010, you probably know that, when you create a SharePoint Feature and generate the SharePoint package (WSP file), the final name given to that feature is not what you expected. If you create a new SharePoint project named MyProject, and then create a feature [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/andrevala/2010/08/21/renaming-a-feature-in-sharepoint-tools-for-visual-studio-2010/">Renaming a Feature in SharePoint Tools for Visual Studio 2010</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>If you’ve created SharePoint projects using <strong>SharePoint Tools for Visual Studio 2010</strong>, you probably know that, when you create a SharePoint Feature and generate the SharePoint package (WSP file), the final name given to that feature is not what you expected.</p>
<p>If you create a new SharePoint project named <strong>MyProject</strong>, and then create a feature inside it named <strong>MyFeature</strong>, the final name and folder for the feature will be <strong>MyProject_MyFeature</strong>. </p>
<p>I don’t know about you, but I like the features to have the names I give them, without the project’s name added to them. The good news is that you can change it 🙂</p>
<p>Here’s how:</p>
<ol>
<li>On Solution Explorer, double-click the Feature name to open the Feature Editor </li>
<li>On Packaging Explorer, click on the Feature name </li>
<li>On the Properties window, change the value in the <strong>Deployment Path</strong> property </li>
</ol>
<p><a href="http://img838.imageshack.us/img838/7316/renamesharepointfeature.jpg" target="_blank"><img decoding="async" border="0" alt="Renaming a SharePoint Feature" src="http://img838.imageshack.us/img838/7316/renamesharepointfeature.jpg" width="700" height="427"> </a></p>
<p>By default, the value for this property is:</p>
<p><strong>$SharePoint.Project.FileNameWithoutExtension$_</strong><strong>$SharePoint.Feature.FileNameWithoutExtension$</strong></p>
<p>To remove the project’s name from the Feature name, just remove the first token (and the trailing underscore), leaving it as:</p>
<p><strong>$SharePoint.Feature.FileNameWithoutExtension$</strong></p>
<p>The post <a href="https://blogit.create.pt/andrevala/2010/08/21/renaming-a-feature-in-sharepoint-tools-for-visual-studio-2010/">Renaming a Feature in SharePoint Tools for Visual Studio 2010</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/andrevala/2010/08/21/renaming-a-feature-in-sharepoint-tools-for-visual-studio-2010/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SharePoint 2007 Deployment: Using Resources in Features</title>
		<link>https://blogit.create.pt/andrevala/2009/05/02/sharepoint-2007-deployment-using-resources-in-features/</link>
					<comments>https://blogit.create.pt/andrevala/2009/05/02/sharepoint-2007-deployment-using-resources-in-features/#respond</comments>
		
		<dc:creator><![CDATA[André Vala]]></dc:creator>
		<pubDate>Sat, 02 May 2009 20:08:40 +0000</pubDate>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Localization]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WSS]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/andrevala/?p=621</guid>

					<description><![CDATA[<p>This series of posts about SharePoint deployment would not be complete if I didn’t write one about using resources in Features to allow localization. After all, SharePoint’s out-of-the-box features use resources all the time. Check the first post SharePoint 2007 Deployment: Overview for an introduction and the series index. Why should I use Resources? In [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/andrevala/2009/05/02/sharepoint-2007-deployment-using-resources-in-features/">SharePoint 2007 Deployment: Using Resources in Features</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This series of posts about SharePoint deployment would not be complete if I didn’t write one about using resources in Features to allow localization. After all, SharePoint’s out-of-the-box features use resources all the time. Check the first post <a href="http://blogit.create.pt/blogs/andrevala/archive/2007/12/02/SharePoint-2007-Deployment_3A00_-Overview.aspx">SharePoint 2007 Deployment: Overview</a> for an introduction and the series index.</p>
<h3>Why should I use Resources?</h3>
<p>In my opinion, you should <strong>always</strong> use resource files for your features. Why? </p>
<ul>
<li>First, because it’s easy to do even if you only have one language. </li>
<li>Second, because if you do, all the objects you are provisioning in SharePoint will be localized and will be displayed in the correct language of the website (provided you have deployed the resource file for that language). </li>
</ul>
<p>Examples of things that should be placed in resource files:</p>
<ul>
<li><strong>Title</strong> and <strong>Description</strong> of you feature, so that they will be displayed in the language of the website; </li>
<li>Site column <strong>display name</strong> and <strong>description</strong>; </li>
<li>Content type <strong>name</strong> and <strong>description</strong>; </li>
<li>List template <strong>name</strong> and <strong>description</strong>; </li>
<li>List instance <strong>title</strong> and <strong>description</strong>; </li>
<li>Custom action <strong>title</strong> and <strong>description</strong>. </li>
</ul>
<h3>How do I use it?</h3>
<p>There are three steps to use resources in a feature:</p>
<ol>
<li>Build the resource (<code>.resx</code>) files; </li>
<li>Place the resource files in the correct folder; </li>
<li>Use the resource strings in the feature manifest and element manifests. </li>
</ol>
<p><strong>Note:</strong> The next sections show how to use feature-specific resources. I’ll briefly discuss shared resources in the end of the post.</p>
<h4>Building the resource (.resx) files</h4>
<p>The best way to build the resource files is using Visual Studio 2008, but you can do it manually on any text editor since they’re just XML text files.</p>
<pre class="code"><span style="color: blue">&lt;?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot; <span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot;<span style="color: blue">?&gt;
&lt;</span><span style="color: #a31515">root</span><span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">resheader </span><span style="color: red">name</span><span style="color: blue">=</span>&quot;<span style="color: blue">resmimetype</span>&quot;<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">value</span><span style="color: blue">&gt;</span>text/microsoft-resx<span style="color: blue">&lt;/</span><span style="color: #a31515">value</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">resheader</span><span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">resheader </span><span style="color: red">name</span><span style="color: blue">=</span>&quot;<span style="color: blue">version</span>&quot;<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">value</span><span style="color: blue">&gt;</span>2.0<span style="color: blue">&lt;/</span><span style="color: #a31515">value</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">resheader</span><span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">resheader </span><span style="color: red">name</span><span style="color: blue">=</span>&quot;<span style="color: blue">reader</span>&quot;<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">value</span><span style="color: blue">&gt;
      </span>System.Resources.ResXResourceReader, 
      System.Windows.Forms, 
      Version=2.0.0.0, 
      Culture=neutral, 
      PublicKeyToken=b77a5c561934e089
    <span style="color: blue">&lt;/</span><span style="color: #a31515">value</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">resheader</span><span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">resheader </span><span style="color: red">name</span><span style="color: blue">=</span>&quot;<span style="color: blue">writer</span>&quot;<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">value</span><span style="color: blue">&gt;
      </span>System.Resources.ResXResourceWriter, 
      System.Windows.Forms, 
      Version=2.0.0.0, 
      Culture=neutral, 
      PublicKeyToken=b77a5c561934e089
    <span style="color: blue">&lt;/</span><span style="color: #a31515">value</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">resheader</span><span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">data </span><span style="color: red">name</span><span style="color: blue">=</span>&quot;<span style="color: blue">MyFeatureName</span>&quot; <span style="color: red">xml:space</span><span style="color: blue">=</span>&quot;<span style="color: blue">preserve</span>&quot;<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">value</span><span style="color: blue">&gt;</span>My Feature Name<span style="color: blue">&lt;/</span><span style="color: #a31515">value</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">data</span><span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">data </span><span style="color: red">name</span><span style="color: blue">=</span>&quot;<span style="color: blue">MyFieldDisplayName</span>&quot; <span style="color: red">xml:space</span><span style="color: blue">=</span>&quot;<span style="color: blue">preserve</span>&quot;<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">value</span><span style="color: blue">&gt;</span>My Field Display Name<span style="color: blue">&lt;/</span><span style="color: #a31515">value</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">data</span><span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">data </span><span style="color: red">name</span><span style="color: blue">=</span>&quot;<span style="color: blue">MyFieldChoice1</span>&quot; <span style="color: red">xml:space</span><span style="color: blue">=</span>&quot;<span style="color: blue">preserve</span>&quot;<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">value</span><span style="color: blue">&gt;</span>My Choice 1<span style="color: blue">&lt;/</span><span style="color: #a31515">value</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">data</span><span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">data </span><span style="color: red">name</span><span style="color: blue">=</span>&quot;<span style="color: blue">MyFieldChoice2</span>&quot; <span style="color: red">xml:space</span><span style="color: blue">=</span>&quot;<span style="color: blue">preserve</span>&quot;<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">value</span><span style="color: blue">&gt;</span>My Choice 2<span style="color: blue">&lt;/</span><span style="color: #a31515">value</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">data</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">root</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><a href="http://11011.net/software/vspaste"></a>See above an example of a resource (<code>.resx</code>) file. The <code>&lt;data&gt;</code> elements are the ones that hold the localized strings:</p>
<ul>
<li>The <code>name</code> attribute is the key used to retrieve the localized string; </li>
<li>The <code>&lt;value&gt;</code> child element is the localized string itself. </li>
</ul>
<p>Each language must have its own resource file which follows a specific naming convention:</p>
<ul>
<li>The main resource file must be called <code><strong>Resources.resx</strong></code>. This is the culture neutral resource file (or fall back resource file) which will be used by SharePoint whenever there is no resource file for a specific culture. </li>
<li>All culture specific resource files must be named <code><strong>Resources.[culture].resx</strong></code>. Some examples:
<ul>
<li><code>Resources.en-US.resx</code> (english – United States) </li>
<li><code>Resources.pt-PT.resx</code> (portuguese – Portugal) </li>
<li><code>Resources.fr-FR.resx</code> (french – France) </li>
<li><code>Resources.pt-BR.resx</code> (portuguese – Brazil) </li>
</ul>
</li>
</ul>
<h4>Placing the resource files in the correct folder</h4>
<p>These files must be placed in a <strong>Resources</strong> folder inside your feature’s folder. So, if your feature’s folder is <code>C:\…\12\TEMPLATE\FEATURES\MyFeature</code>, the resource files need to be placed in the folder <code>C:\…\12\TEMPLATE\FEATURES\MyFeature\Resources</code>.</p>
<h4>Resources and the Feature Manifest</h4>
<p>After you have created the resource files and placed the in the correct folder, you can now used them in your feature manifest (<code>feature.xml</code>).</p>
<pre class="code"><span style="color: blue">&lt;?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot; <span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot; <span style="color: blue">?&gt;
&lt;</span><span style="color: #a31515">Feature </span><span style="color: red">xmlns</span><span style="color: blue">=</span>&quot;<span style="color: blue">http://schemas.microsoft.com/sharepoint/</span>&quot;
         <span style="color: red">Id</span><span style="color: blue">=</span>&quot;<span style="color: blue">5DFD12AF-D0AA-4c63-8FB8-C49DB1191083</span>&quot;
         <span style="color: red">Title</span><span style="color: blue">=</span>&quot;<span style="color: blue">$Resources:MyFeatureName</span>&quot;
         <span style="color: red">Scope</span><span style="color: blue">=</span>&quot;<span style="color: blue">Site</span>&quot;
         <span style="color: red">Version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0.0.0</span>&quot;<span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">ElementManifests</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">ElementManifest </span><span style="color: red">Location</span><span style="color: blue">=</span>&quot;<span style="color: blue">SiteColumns.xml</span>&quot;<span style="color: blue">/&gt;
    &lt;</span><span style="color: #a31515">ElementFile </span><span style="color: red">Location</span><span style="color: blue">=</span>&quot;<span style="color: blue">Resources\Resources.resx</span>&quot; <span style="color: blue">/&gt;
    &lt;</span><span style="color: #a31515">ElementFile </span><span style="color: red">Location</span><span style="color: blue">=</span>&quot;<span style="color: blue">Resources\Resources.pt-PT.resx</span>&quot; <span style="color: blue">/&gt;
    &lt;</span><span style="color: #a31515">ElementFile </span><span style="color: red">Location</span><span style="color: blue">=</span>&quot;<span style="color: blue">Resources\Resources.es-ES.resx</span>&quot; <span style="color: blue">/&gt;
  &lt;/</span><span style="color: #a31515">ElementManifests</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">Feature</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>The sample above, shows a feature manifest that uses resources to specify the feature title. As you can see, the value of the <code>Title</code> attribute is <code><strong>$Resources:MyFeatureName</strong></code>. This tells SharePoint that it should check the resource file for the current website’s culture and retrieve the string that has the key <code>MyFeatureName</code>.</p>
<p>Notice the use of <code>&lt;ElementFile&gt;</code> elements to reference the resource files in the feature. This is required if you are deploying this feature through a solution package (<code>.wsp</code>).</p>
<p><strong>Important:</strong> because we are using feature-specific resource files (resource files that are only used for this specific feature), you cannot use the <code>DefaultResourceFile</code> attribute on the <code>&lt;Feature&gt;</code> element. If you do, SharePoint will not look for resource files in the local <code>Resources</code> folder for this feature.</p>
<h4>Resources and the Element Manifest</h4>
<p>Besides using localized strings to specify the feature title and description, you can (and should) use localized strings for most feature elements.</p>
<pre class="code"><span style="color: blue">&lt;?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot; <span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot; <span style="color: blue">?&gt;
&lt;</span><span style="color: #a31515">Elements </span><span style="color: red">xmlns</span><span style="color: blue">=</span>&quot;<span style="color: blue">http://schemas.microsoft.com/sharepoint/</span>&quot;<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Field </span><span style="color: red">Type</span><span style="color: blue">=</span>&quot;<span style="color: blue">Choice</span>&quot;
         <span style="color: red">DisplayName</span><span style="color: blue">=</span>&quot;<span style="color: blue"><strong>$Resources:MyFieldDisplayName</strong></span>&quot;
         <span style="color: red">Required</span><span style="color: blue">=</span>&quot;<span style="color: blue">FALSE</span>&quot;
         <span style="color: red">Format</span><span style="color: blue">=</span>&quot;<span style="color: blue">Dropdown</span>&quot;
         <span style="color: red">FillInChoice</span><span style="color: blue">=</span>&quot;<span style="color: blue">FALSE</span>&quot;
         <span style="color: red">ID</span><span style="color: blue">=</span>&quot;<span style="color: blue">{485b2176-4cfc-4923-8085-c003b85dab36}</span>&quot;
         <span style="color: red">StaticName</span><span style="color: blue">=</span>&quot;<span style="color: blue">MyField</span>&quot;
         <span style="color: red">Name</span><span style="color: blue">=</span>&quot;<span style="color: blue">MyField</span>&quot;<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Default</span><span style="color: blue">&gt;</span><strong>$Resources:MyFieldChoice1</strong><span style="color: blue">&lt;/</span><span style="color: #a31515">Default</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">CHOICES</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">CHOICE</span><span style="color: blue">&gt;</span><strong>$Resources:MyFieldChoice1</strong><span style="color: blue">&lt;/</span><span style="color: #a31515">CHOICE</span><span style="color: blue">&gt;
      &lt;</span><span style="color: #a31515">CHOICE</span><span style="color: blue">&gt;</span><strong>$Resources:MyFieldChoice2</strong><span style="color: blue">&lt;/</span><span style="color: #a31515">CHOICE</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: #a31515">CHOICES</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">Field</span><span style="color: blue">&gt;
 &lt;/</span><span style="color: #a31515">Elements</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>The sample above specifies a choice field, and uses localized strings for:</p>
<ul>
<li>Field display name </li>
<li>Each of the field’s choices </li>
<li>The field’s default choice </li>
</ul>
<p>The theory is exactly the same as it was used for the feature manifest: you use the expression <code>$Resources:[key]</code> whenever you want SharePoint to retrieve a localized string from the resource file of the current website’s culture.</p>
<h3>Shared Resource Files</h3>
<p>The method shown in the previous sections assumed that each feature has its own resource files. However, that is not always the case and SharePoint itself uses shared resource files. That is, resource files that can be shared by multiple features.</p>
<p>There are only two differences when using shared resource files:</p>
<ul>
<li>The folder where the resource files are placed; </li>
<li>The way you reference the localized string in you feature manifest and element manifests. </li>
</ul>
<p>Other than that, the file format and contents can be exactly the same.</p>
<h4>Folder for Shared Resources</h4>
<p>Shared resource files must be placed in the folder <code>C:\…\12\Resources</code> instead of the local Resources folder inside the feature folder.</p>
<h4>Referencing Shared Resources</h4>
<p>Because the shared resources files can have any name you want, you must reference the localized strings in a more specific way, so as to tell SharePoint which resource file holds a particular string.</p>
<pre class="code"><span style="color: blue">&lt;?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot; <span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot; <span style="color: blue">?&gt;
&lt;</span><span style="color: #a31515">Feature </span><span style="color: red">xmlns</span><span style="color: blue">=</span>&quot;<span style="color: blue">http://schemas.microsoft.com/sharepoint/</span>&quot;
         <span style="color: red">Id</span><span style="color: blue">=</span>&quot;<span style="color: blue">5DFD12AF-D0AA-4c63-8FB8-C49DB1191083</span>&quot;
         <span style="color: red">Title</span><span style="color: blue">=</span>&quot;<span style="color: blue"><strong>$Resources:MyResources,MyFeatureName</strong></span>&quot;
         <span style="color: red">Scope</span><span style="color: blue">=</span>&quot;<span style="color: blue">Site</span>&quot;
         <span style="color: red">Version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0.0.0</span>&quot;<span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">ElementManifests</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">ElementManifest </span><span style="color: red">Location</span><span style="color: blue">=</span>&quot;<span style="color: blue">SiteColumns.xml</span>&quot;<span style="color: blue">/&gt;
  &lt;/</span><span style="color: #a31515">ElementManifests</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">Feature</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<h5></h5>
<p>As you can see in the above sample, instead of <code>$Resources:MyFeatureName</code> I’m referencing the localized string with <code>$Resources:MyResources,MyFeatureName</code>. This tells SharePoint to look for:</p>
<ul>
<li>A localized string whose key is <code>MyFeatureName</code> </li>
<li>In a resource file named <code>MyResources.[Culture].resx</code> </li>
<li>In the <code>C:\…\12\Resources</code> folder </li>
</ul>
<p>If all your strings are in the same shared resource file, then you can specify that file as the default resource file and reference the strings as shown in the first sample.</p>
<pre class="code"><span style="color: blue">&lt;?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot; <span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot; <span style="color: blue">?&gt;
&lt;</span><span style="color: #a31515">Feature </span><span style="color: red">xmlns</span><span style="color: blue">=</span>&quot;<span style="color: blue">http://schemas.microsoft.com/sharepoint/</span>&quot;
         <span style="color: red">Id</span><span style="color: blue">=</span>&quot;<span style="color: blue">5DFD12AF-D0AA-4c63-8FB8-C49DB1191083</span>&quot;
         <span style="color: red">Title</span><span style="color: blue">=</span>&quot;<span style="color: blue"><strong>$Resources:MyFeatureName</strong></span>&quot;
         <strong><span style="color: red">DefaultResourceFile</span><span style="color: blue">=</span>&quot;<span style="color: blue">MyResources</span>&quot;</strong>
         <span style="color: red">Scope</span><span style="color: blue">=</span>&quot;<span style="color: blue">Site</span>&quot;
         <span style="color: red">Version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0.0.0</span>&quot;<span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">ElementManifests</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">ElementManifest </span><span style="color: red">Location</span><span style="color: blue">=</span>&quot;<span style="color: blue">SiteColumns.xml</span>&quot;<span style="color: blue">/&gt;
  &lt;/</span><span style="color: #a31515">ElementManifests</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">Feature</span><span style="color: blue">&gt;</span></pre>
<p>The sample above does exactly the same as the previous one. The only difference is that it specifies <code>MyResources.[culture].resx</code> as the default resource file and, because of that, you don’t need to specify it on all references to the localized strings.</p>
<h3>Additional Notes</h3>
<p>So, how does SharePoint choose which resource file to use when loading the localized strings?</p>
<ol>
<li>Looks for the resource file of the exact culture of the website. If you have a website based on a portuguese (pt-PT) site template, it will look for the <code>Resources.pt-PT.resx</code>. If it’s there, it loads all the strings from it. </li>
<li>If it’s not there, it looks for any resource files of the same culture, even if it has a different location. So if your website’s language is pt-PT (Portuguese – Portugal) and you don’t have a <code>Resources.pt-PT.resx</code> file, but you have a <code>Resources.pt-BR.resx</code> (Portuguese – Brazil) file, then SharePoint will use it. </li>
<li>If there is no resource file for the website’s culture, SharePoint will use the fall back resource file (<code>Resources.resx</code>). </li>
</ol>
<h3>Samples</h3>
<p>You can download samples for:</p>
<ul>
<li><a href="http://cid-b4544db7b7183eb8.skydrive.live.com/self.aspx/.Public/Blog%20Data/Feature%20Resources/LocalResources.zip" target="blank">Feature with Local Resources</a> </li>
<li><a href="http://cid-b4544db7b7183eb8.skydrive.live.com/self.aspx/.Public/Blog%20Data/Feature%20Resources/SharedResources.zip" target="blank">Feature with Shared Resources</a> </li>
</ul>
<p>These samples include:</p>
<ul>
<li>The solution manifest file (<code>manifest.xml</code>). </li>
<li>The solution cab structure file (<code>solution.ddf</code>). </li>
<li>The feature manifest file (<code>Feature.xml</code>). </li>
<li>The element manifest file (<code>SiteColumns.xml</code>). </li>
<li>The resource files (<code>.resx</code>) </li>
<li>A batch file (<code>build.bat</code>) that creates the solution package </li>
</ul>
<p><strong>Warning:</strong> Do not install both solutions in the same farm, since some of the IDs are the same and the feature has the same name on both solutions. If you want to use it as is, test each solution separately, removing one before installing the other.</p>
<p><strong>Notice: </strong>These samples are given for illustrative purposes only. Feel free to modify and use them as templates for your solutions and features. </p>
<p>The post <a href="https://blogit.create.pt/andrevala/2009/05/02/sharepoint-2007-deployment-using-resources-in-features/">SharePoint 2007 Deployment: Using Resources in Features</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/andrevala/2009/05/02/sharepoint-2007-deployment-using-resources-in-features/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SharePoint 2007 Deployment: Feature Stapling</title>
		<link>https://blogit.create.pt/andrevala/2009/04/25/sharepoint-2007-deployment-feature-stapling/</link>
					<comments>https://blogit.create.pt/andrevala/2009/04/25/sharepoint-2007-deployment-feature-stapling/#respond</comments>
		
		<dc:creator><![CDATA[André Vala]]></dc:creator>
		<pubDate>Sat, 25 Apr 2009 20:40:31 +0000</pubDate>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WSS]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/andrevala/?p=641</guid>

					<description><![CDATA[<p>Summary This post is about developing features that associate other features to an existing site definition. This is one of the most powerful types of feature since it allows you to add new functionality to existing site definitions. Check the first post SharePoint 2007 Deployment: Overview for an introduction and the series index. Package Structure [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/andrevala/2009/04/25/sharepoint-2007-deployment-feature-stapling/">SharePoint 2007 Deployment: Feature Stapling</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h3>Summary</h3>
<p>This post is about developing features that associate other features to an existing site definition. This is one of the most powerful types of feature since it allows you to add new functionality to existing site definitions. Check the first post <a href="http://blogit.create.pt/blogs/andrevala/archive/2007/12/02/SharePoint-2007-Deployment_3A00_-Overview.aspx">SharePoint 2007 Deployment: Overview</a> for an introduction and the series index.</p>
<h3>Package Structure</h3>
<p>As I mentioned previously in the post <a href="http://blogit.create.pt/blogs/andrevala/archive/2007/12/15/SharePoint-2007-Deployment_3A00_-Creating-and-Using-Features.aspx">SharePoint 2007 Deployment: Creating and Using Features</a>, to build a feature you need to create the following files:</p>
<ul>
<li>The <em>feature manifest</em> file (which must be named <code>feature.xml</code>) </li>
<li>One or more <em>element manifest</em> files </li>
</ul>
<p>The <em>feature manifest</em> file contains the generic information about the feature package, and the <em>element manifest</em> files contain the information about each specific type of element that makes up the feature. Since I already explained all the possible contents of the <em>feature manifest</em> file in the above mentioned post, I will focus this one the <em>element manifest</em> that allows the feature stapling (feature site template association).</p>
<p>You can then place these two files inside a <em>Solution</em> following the instructions in the post <a href="http://blogit.create.pt/blogs/andrevala/archive/2008/02/17/SharePoint-2007-Deployment_3A00_-Creating-Solutions.aspx">SharePoint 2007 Deployment: Creating Solutions</a>, to provide an easy way to deploy the feature (or upgrade it).</p>
<h3>Feature Stapling</h3>
<p>Feature stapling is the process of associating features to existing site definitions so that, when a new site is provisioned from that definition the associated features are automatically activated.</p>
<p>This means that you need, at least, two features to do this:</p>
<ul>
<li>The feature (or features) you wish to associate (that is, to staple) to a site definition; </li>
<li>The feature that performs the association (the stapler). </li>
</ul>
<p>The first one can be any feature with scope <em>Site</em> or <em>Web</em>. The second is the one I’m presenting in this post.</p>
<h3>Allowed Scopes</h3>
<p>The scopes to which a feature can be deployed, are dictated by the types of elements included in it. A feature with feature site template association elements can be deployed to <strong>Site Collection</strong>, <strong>Web Application</strong> or <strong>Farm</strong> scopes. </p>
<h3>Feature Manifest</h3>
<p>I will only present a simple feature manifest, since the additional options were presented in the above mentioned post.</p>
<pre class="code"><span style="color: blue">&lt;?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot; <span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot; <span style="color: blue">?&gt;
&lt;</span><span style="color: #a31515">Feature
    </span><span style="color: red">xmlns</span><span style="color: blue">=</span>&quot;<span style="color: blue">http://schemas.microsoft.com/sharepoint/</span>&quot;
    <span style="color: red">Id</span><span style="color: blue">=</span>&quot;<span style="color: blue">{8213A053-46B0-43f9-B00C-B2A8CF7A3355}</span>&quot;
    <span style="color: red">Title</span><span style="color: blue">=</span>&quot;<span style="color: blue">My Feature Stapling</span>&quot;
    <span style="color: red">Description</span><span style="color: blue">=</span>&quot;<span style="color: blue">This feature staples other features to a<br>    site definition.</span>&quot;
    <span style="color: red">Scope</span><span style="color: blue">=</span>&quot;<span style="color: blue">Farm</span>&quot;
    <span style="color: red">Creator</span><span style="color: blue">=</span>&quot;<span style="color: blue">Create IT</span>&quot;
    <span style="color: red">Version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0.0.0</span>&quot;<span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">ElementManifests</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">ElementManifest </span><span style="color: red">Location</span><span style="color: blue">=</span>&quot;<span style="color: blue">Elements.xml</span>&quot;<span style="color: blue">/&gt;
  &lt;/</span><span style="color: #a31515">ElementManifests</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">Feature</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><p>Notes about this feature manifest:</p>
<ul>
<li>The title of the feature is <em>My Feature Stapling.</em> </li>
<li>It will be deployed as a <strong>Farm </strong>feature, since it&#8217;s <code>Scope</code> value is <code>Farm</code>. By default, SharePoint automatically activates features of this scope. You can, however, override this behaviour by setting the <code>ActivateOnDefault</code> attribute to <code>false</code> on the <code>Feature</code> element. </li>
<li>It references a single <em>element manifest</em> file: <code>Elements.xml</code>. </li>
</ul>
<h3>Element Manifest</h3>
<p>The element manifest file can have any name you wish (in this example it&#8217;s called <code>Elements.xml</code>), but it&#8217;s root element must be <code>&lt;Elements&gt;</code>. Inside this root element, you can place any number of feature element descriptions. In this example I will present the use of the <code>&lt;FeatureSiteTemplateAssociation&gt;</code> element which is used to associate features to existing site definitions.</p>
<pre class="code"><span style="color: blue">&lt;?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot; <span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot; <span style="color: blue">?&gt;
&lt;</span><span style="color: #a31515">Elements </span><span style="color: red">xmlns</span><span style="color: blue">=</span>&quot;<span style="color: blue">http://schemas.microsoft.com/sharepoint/</span>&quot;<span style="color: blue">&gt;
  &lt;!-- </span><span style="color: green">My Site Columns </span><span style="color: blue">--&gt;
  &lt;</span><span style="color: #a31515">FeatureSiteTemplateAssociation 
    </span><span style="color: red">Id</span><span style="color: blue">=</span>&quot;<span style="color: blue">{CC3144A5-E055-4474-928E-5D21CDE53D38}</span>&quot; 
    <span style="color: red">TemplateName</span><span style="color: blue">=</span>&quot;<span style="color: blue">STS#0</span>&quot; <span style="color: blue">/&gt;
  &lt;!-- </span><span style="color: green">My Content Types </span><span style="color: blue">--&gt;
  &lt;</span><span style="color: #a31515">FeatureSiteTemplateAssociation 
    </span><span style="color: red">Id</span><span style="color: blue">=</span>&quot;<span style="color: blue">{E739683D-ACB8-4187-A764-1323BE76D12D}</span>&quot; 
    <span style="color: red">TemplateName</span><span style="color: blue">=</span>&quot;<span style="color: blue">STS#0</span>&quot; <span style="color: blue">/&gt;
&lt;/</span><span style="color: #a31515">Elements</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>This example associates two features with the <em>Team Site</em> definition. The <code>&lt;FeatureSiteTemplateAssociation&gt;</code> element has no child elements and only two attributes:</p>
<ul>
<li><code>Id</code> &#8211; (required) The GUID of the feature that is to be stapled to the site definition. </li>
<li><code>TemplateName</code> &#8211; (required) The name of the site definition including the configuration Id. For SharePoint’s out-of-the-box site definitions, this attribute can be:
<ul>
<li><code>STS#0</code> (Team Site) </li>
<li><code>STS#1</code> (Blank Site) </li>
<li><code>STS#2</code> (Document Workspace) </li>
<li><code>MPS#0</code> (Basic Meeting Workspace) </li>
<li><code>MPS#1</code> (Blank Meeting Workspace) </li>
<li><code>MPS#2</code> (Decision Meeting Workspace) </li>
<li><code>MPS#3</code> (Social Meeting Workspace) </li>
<li><code>MPS#4</code> (Multipage Meeting Workspace) </li>
<li><code>CENTRALADMIN#0</code> (Central Administration) </li>
<li><code>WIKI#0</code> (Wiki Site) </li>
<li><code>BLOG#0</code> (Blog Site) </li>
<li><code>BDR#0</code> (Document Center) </li>
<li><code>OFFILE#1</code> (Records Center) </li>
<li><code>SPSMSITEHOST#0</code> (My Site Host) </li>
<li><code>SPSMSITE#0</code> (Personalization Site) </li>
<li><code>CMSPUBLISHING#0</code> (Publishing Site) </li>
<li><code>BLANKINTERNET#2</code> (Publishing Site with Workflow) </li>
<li><code>BLANKINTERNETCONTAINER#0</code> (Publishing Portal) </li>
<li><code>SPSPORTAL#0</code> (Collaboration Portal) </li>
<li><code>SPSNHOME#0</code> (News Site) </li>
<li><code>SPSITES#0</code> (Site Directory) </li>
<li><code>SPSREPORTCENTER#0</code> (Report Center) </li>
<li><code>SRCHCEN#0</code> (Search Center with Tabs) </li>
<li><code>SRCHCENTERLITE#0</code> (Search Center) </li>
</ul>
</li>
</ul>
<p>There can be other site definitions depending on which site templates you have installed on your farm. The best way to check which ones you can use is to go to the folder <code>C:\…\12\TEMPLATE\[LCID]\XML</code> where <code>[LCID]</code> represent the Language ID of the site definition you are looking for, and open each <code>webtemp*.xml</code> file.</p>
<p>Each of these files will have the following structure:</p>
<pre class="code"><span style="color: blue">&lt;?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot; <span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot;<span style="color: blue">?&gt;
&lt;!-- </span><span style="color: green">_lcid=&quot;1033&quot; _version=&quot;12.0.4518&quot; _dal=&quot;1&quot; </span><span style="color: blue">--&gt;
&lt;!-- </span><span style="color: green">_LocalBinding </span><span style="color: blue">--&gt;
&lt;</span><span style="color: #a31515">Templates </span><span style="color: red">xmlns:ows</span><span style="color: blue">=</span>&quot;<span style="color: blue">Microsoft SharePoint</span>&quot;<span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">Template </span><span style="color: red">Name</span><span style="color: blue">=</span>&quot;<span style="color: blue">STS</span>&quot; <span style="color: red">ID</span><span style="color: blue">=</span>&quot;<span style="color: blue">1</span>&quot;<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Configuration </span><span style="color: red">ID</span><span style="color: blue">=</span>&quot;<span style="color: blue">0</span>&quot; 
                   <span style="color: red">Title</span><span style="color: blue">=</span>&quot;<span style="color: blue">Team Site</span>&quot; 
                   <span style="color: red">Hidden</span><span style="color: blue">=</span>&quot;<span style="color: blue">FALSE</span>&quot; 
                   <span style="color: red">ImageUrl</span><span style="color: blue">=</span>&quot;<span style="color: blue">/_layouts/images/stsprev.png</span>&quot; 
                   <span style="color: red">Description</span><span style="color: blue">=</span>&quot;<span style="color: blue">A site for teams to quickly […]</span> 
                   <span style="color: red">DisplayCategory</span><span style="color: blue">=</span>&quot;<span style="color: blue">Collaboration</span>&quot; <span style="color: blue">&gt;          
    &lt;/</span><span style="color: #a31515">Configuration</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Configuration </span><span style="color: red">ID</span><span style="color: blue">=</span>&quot;<span style="color: blue">1</span>&quot; 
                   <span style="color: red">Title</span><span style="color: blue">=</span>&quot;<span style="color: blue">Blank Site</span>&quot; 
                   <span style="color: red">Hidden</span><span style="color: blue">=</span>&quot;<span style="color: blue">FALSE</span>&quot; 
                   <span style="color: red">ImageUrl</span><span style="color: blue">=</span>&quot;<span style="color: blue">/_layouts/images/blankprev.png</span>&quot; 
                   <span style="color: red">Description</span><span style="color: blue">=</span>&quot;<span style="color: blue">A blank site for you to […]</span> 
                   <span style="color: red">DisplayCategory</span><span style="color: blue">=</span>&quot;<span style="color: blue">Collaboration</span>&quot; 
                   <span style="color: red">AllowGlobalFeatureAssociations</span><span style="color: blue">=</span>&quot;<span style="color: blue">False</span>&quot; <span style="color: blue">&gt;      
    &lt;/</span><span style="color: #a31515">Configuration</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Configuration </span><span style="color: red">ID</span><span style="color: blue">=</span>&quot;<span style="color: blue">2</span>&quot; 
                   <span style="color: red">Title</span><span style="color: blue">=</span>&quot;<span style="color: blue">Document Workspace</span>&quot; 
                   <span style="color: red">Hidden</span><span style="color: blue">=</span>&quot;<span style="color: blue">FALSE</span>&quot; 
                   <span style="color: red">ImageUrl</span><span style="color: blue">=</span>&quot;<span style="color: blue">/_layouts/images/dwsprev.png</span>&quot; 
                   <span style="color: red">Description</span><span style="color: blue">=</span>&quot;<span style="color: blue">A site for colleagues to work[…]</span> 
                   <span style="color: red">DisplayCategory</span><span style="color: blue">=</span>&quot;<span style="color: blue">Collaboration</span>&quot; <span style="color: blue">&gt;          
    &lt;/</span><span style="color: #a31515">Configuration</span><span style="color: blue">&gt;
    </span>[...]
  <span style="color: blue">&lt;/</span><span style="color: #a31515">Template</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">Templates</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>In the sample above you can see the description of the three configurations of the STS site template. To build the <code>TemplateName</code> required for the feature site template association, you get the template name (attribute <code>Name</code> of the element <code>Template</code>), which in this case is <code>STS</code>, add a hash sign (<code>#</code>) and complete the string with the configuration ID (attribute <code>ID</code> of the element <code>Configuration</code>), which in this case can be <code>0</code>, <code>1</code> or <code>2</code>, depending on the chosen configuration.</p>
<h3>Sample</h3>
<p>You can download this sample <a href="http://ydcqka.bay.livefilestore.com/y1p6oIxj6THKZnRIUbgwuVrdTXCYSfMXnCQ9vV5tClPLTY2Oy4onsPFG428MAiXqlVgfeWjJJfW0VmBmr45C47r_MGcdjgT48y8/FeatureStaplingSample.zip?download">here</a>. This sample includes:</p>
<ul>
<li>The solution manifest file (<code>manifest.xml</code>). </li>
<li>The solution cab structure file (<code>solution.ddf</code>). </li>
<li>The feature manifest file (<code>Feature.xml</code>). </li>
<li>The feature site template association element manifest file (<code>Elements.xml</code>). </li>
<li>A batch file (<code>build.bat</code>) that creates the solution package (<code>MyFeatureStapling.wsp</code>). </li>
</ul>
<p><strong>Notice: </strong>This sample is given for illustrative purposes only. Feel free to modify and use it as a template for your solutions and features.</p>
<p>The post <a href="https://blogit.create.pt/andrevala/2009/04/25/sharepoint-2007-deployment-feature-stapling/">SharePoint 2007 Deployment: Feature Stapling</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/andrevala/2009/04/25/sharepoint-2007-deployment-feature-stapling/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SharePoint 2007 Deployment: Content Type Binding Features</title>
		<link>https://blogit.create.pt/andrevala/2009/03/31/sharepoint-2007-deployment-content-type-binding-features/</link>
					<comments>https://blogit.create.pt/andrevala/2009/03/31/sharepoint-2007-deployment-content-type-binding-features/#respond</comments>
		
		<dc:creator><![CDATA[André Vala]]></dc:creator>
		<pubDate>Tue, 31 Mar 2009 17:55:00 +0000</pubDate>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WSS]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/andrevala/?p=661</guid>

					<description><![CDATA[<p>Summary This post is about developing features to bind content types to lists that were provisioned through an onet.xml file. Check the first post SharePoint 2007 Deployment: Overview for an introduction and the series index. Package Structure As I mentioned previously in the post SharePoint 2007 Deployment: Creating and Using Features, to build a feature [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/andrevala/2009/03/31/sharepoint-2007-deployment-content-type-binding-features/">SharePoint 2007 Deployment: Content Type Binding Features</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h3>Summary</h3>
<p>This post is about developing features to bind content types to lists that were provisioned through an <strong>onet.xml</strong> file. Check the first post <a href="/blogs/andrevala/archive/2007/12/02/SharePoint-2007-Deployment_3A00_-Overview.aspx">SharePoint 2007 Deployment: Overview</a> for an introduction and the series index.</p>
<h3>Package Structure</h3>
<p>As I mentioned previously in the post <a href="/blogs/andrevala/archive/2007/12/15/SharePoint-2007-Deployment_3A00_-Creating-and-Using-Features.aspx">SharePoint 2007 Deployment: Creating and Using Features</a>, to build a feature you need to create the following files:</p>
<ul>
<li>The <em>feature manifest</em> file (which must be named <code>feature.xml</code>) </li>
<li>One or more <em>element manifest</em> files </li>
</ul>
<p>The <em>feature manifest</em> file contains the generic information about the feature package, and the <em>element manifest</em> files contain the information about each specific type of element that makes up the feature. Since I already explained all the possible contents of the <em>feature manifest</em> file in the above mentioned post, I will focus this one the <em>element manifest</em> that allows the binding of content types.</p>
<p>You can then place these two files inside a <em>Solution</em> following the instructions in the post <a href="/blogs/andrevala/archive/2008/02/17/SharePoint-2007-Deployment_3A00_-Creating-Solutions.aspx">SharePoint 2007 Deployment: Creating Solutions</a>, to provide an easy way to deploy the feature (or upgrade it).</p>
<h3>Content Type Binding</h3>
<p>When you provision a list through a feature, using the method explained in the post <a href="/blogs/andrevala/archive/2008/05/17/SharePoint-2007-Deployment_3A00_-List-Template-Features.aspx">SharePoint 2007 Deployment: List Template Features</a>, you can bind a content type to it only by editing the <code>schema.xml</code> file of the list template.</p>
<p>However, if the list was provisioned through a site definition (<code>onet.xml</code> file) and you had no access to its definition, you must do it using a <strong>Content Type Binding</strong> feature element. This can only be used to attach a content type to a list provisioned through a site definition.</p>
<h3>Allowed Scopes</h3>
<p>The scopes to which a feature can be deployed, are dictated by the types of elements included in it. A feature with content type binding elements can only be deployed to a <strong>Site Collection</strong> scope.</p>
<p>Attempting to install a feature of another scope that contains content type binding elements, will result in an error.</p>
<h3>Feature Manifest</h3>
<p>I will only present a simple feature manifest, since the additional options were presented in the above mentioned post.</p>
<pre class="code"><span style="color: blue">&lt;?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot; <span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot; <span style="color: blue">?&gt;
&lt;</span><span style="color: #a31515">Feature
    </span><span style="color: red">xmlns</span><span style="color: blue">=</span>&quot;<span style="color: blue">http://schemas.microsoft.com/sharepoint/</span>&quot;
    <span style="color: red">Id</span><span style="color: blue">=</span>&quot;<span style="color: blue">{ACDECF85-BDF7-446c-AC1B-C5F133C83F15}</span>&quot;
    <span style="color: red">Title</span><span style="color: blue">=</span>&quot;<span style="color: blue">Content Type Binding</span>&quot;
    <span style="color: red">Description</span><span style="color: blue">=</span>&quot;<span style="color: blue">This feature binds a content type to the masterpage<br></span><span style="color: blue">gallery.</span>&quot;
    <span style="color: red">Scope</span><span style="color: blue">=</span>&quot;<span style="color: blue">Site</span>&quot;
    <span style="color: red">Creator</span><span style="color: blue">=</span>&quot;<span style="color: blue">Create IT</span>&quot;
    <span style="color: red">Version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0.0.0</span>&quot;<span style="color: blue">&gt;
  
  &lt;</span><span style="color: #a31515">ElementManifests</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">ElementManifest </span><span style="color: red">Location</span><span style="color: blue">=</span>&quot;<span style="color: blue">ContentTypeBinding.xml</span>&quot;<span style="color: blue">/&gt;
  &lt;/</span><span style="color: #a31515">ElementManifests</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">Feature</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Notes about this feature manifest:</p>
<ul>
<li>The title of the feature is <em>Content Type Binding.</em> </li>
<li>It will be deployed as a <strong>Site Collection</strong> feature, since it&#039;s <code>Scope</code> value is <code>Site</code>. </li>
<li>It references a single <em>element manifest</em> file: <code>ContentTypeBinding.xml</code>. </li>
</ul>
<h3>Element Manifest</h3>
<p>The element manifest file can have any name you wish (in this example it&#039;s called <code>ContentTypeBinding.xml</code>), but it&#039;s root element must be <code>&lt;Elements&gt;</code>. Inside this root element, you can place any number of feature element descriptions. In this example I will present the use of the <code>&lt;ContentTypeBinding&gt;</code> element which is used to binding Content Types to list definitions.</p>
<pre class="code"><span style="color: blue">&lt;?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot; <span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot; <span style="color: blue">?&gt;
&lt;</span><span style="color: #a31515">Elements </span><span style="color: red">xmlns</span><span style="color: blue">=</span>&quot;<span style="color: blue">http://schemas.microsoft.com/sharepoint/</span>&quot;<span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">ContentTypeBinding
    </span><span style="color: red">ContentTypeId</span><span style="color: blue">=</span>&quot;<span style="color: blue">0x010101</span>&quot;
    <span style="color: red">ListUrl</span><span style="color: blue">=</span>&quot;<span style="color: blue">_catalogs/masterpage</span>&quot; <span style="color: blue">/&gt;
&lt;/</span><span style="color: #a31515">Elements</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a>This example binds the content type <em>Form</em> (which has the ID <code>0x010101</code>) to the master page gallery (which has the URL <code>_catalogs/masterpage</code>). There <code>&lt;ContentTypeBinding&gt;</code> element has no child elements, and only two attributes:</p>
<ul>
<li><code>ContentTypeId</code> &#8211; (required) The ID of the content type that will be bound to a list. </li>
<li><code>ListUrl</code> &ndash; (required) The URL of the list to which the content type will be bound. </li>
</ul>
<h3>Additional Notes</h3>
<p>The content type will be bound to the list definition as soon as the administrator activates this feature on a site collection. However, deactivating the feature will not remove the connection between the content type and the list. If you wish to remove it, you must do so manually.</p>
<h3>Sample</h3>
<p>You can download this sample <a href="http://cid-b4544db7b7183eb8.skydrive.live.com/self.aspx/.Public/Blog%20Data/Content%20Type%20Binding%20Feature/ContentTypeBindingSample.zip">here</a>. This sample includes:</p>
<ul>
<li>The solution manifest file (<code>manifest.xml</code>). </li>
<li>The solution cab structure file (<code>solution.ddf</code>). </li>
<li>The feature manifest file (<code>feature.xml</code>). </li>
<li>The content type binding element manifest file (<code>ContentTypeBinding.xml</code>). </li>
<li>A batch file (<code>build.bat</code>) that creates the solution package (<code>ContentTypeBinding.wsp</code>). </li>
</ul>
<p><strong>Notice: </strong>This sample is given for illustrative purposes only. Feel free to modify and use it as a template for your solutions and features.</p>
<p>The post <a href="https://blogit.create.pt/andrevala/2009/03/31/sharepoint-2007-deployment-content-type-binding-features/">SharePoint 2007 Deployment: Content Type Binding Features</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/andrevala/2009/03/31/sharepoint-2007-deployment-content-type-binding-features/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
