Showing posts with label custom content type. Show all posts
Showing posts with label custom content type. Show all posts

Friday, July 15, 2011

Tips & Tricks: IDs of standard out-of-the-box SharePoint fields

Another useful - How To find out the IDs of standard out-of-the-box SharePoint fields (like Title, Created By, Modified, File Size etc):
The best way is to look at the source - the same location where actually SharePoint is reading them. I am always looking at this file when I have to use out of the box fields in my custom content types.

Here is the location of the XML file that describes all fields with their GUIDs, internal names and, type and so on. The file can be found in 14 hive, in the Template -> Features floder, and the name of the feature is "fields". Inside this folder you can find fieldswss.xml that contais all the information we need:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\fields\fieldswss.xml

Here is an example of the fields description:

<!-- End Shared Among Base\List with Same Internal Name -->

<!-- Shared Among Base\List with Same Internal Name -->

    <Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}"
         Name="Title"

         SourceID="http://schemas.microsoft.com/sharepoint/v3"
         StaticName="Title"
         Group="_Hidden"
         Type="Text"
         DisplayName="$Resources:core,Title;"
         Required="TRUE"
         FromBaseType="TRUE">
    </Field>

    <Field ID="{f1e020bc-ba26-443f-bf2f-b68715017bbc}"
        Name="WorkflowVersion"

        SourceID="http://schemas.microsoft.com/sharepoint/v3"
        StaticName="WorkflowVersion"
        Group="_Hidden"
        ColName="tp_WorkflowVersion"
        RowOrdinal="0"
        Hidden="TRUE"
        ReadOnly="TRUE"
        Type="Integer"
        DisplayName="$Resources:core,WorkflowVersion;" />

Tuesday, July 5, 2011

Tips & Tricks: quick deployment of .DLLs to GAC

Quick Tips & Tricks 
In this post I will try to put some of the tips & tricks we are using every day as a SharePoint developers. Hopefully you will find something that will help you and make your life a bit easier

Tip 1 - quick deployment of .DLLs:
One of the most used by me: PS script for quick deployment of DLLs in GAC and recycle the application pools. Every SharePoint developer is doing this at least 20 times per day. Of course we can use the deployment options of Visual Studio but usually when the change is in code behind we want a short way to replace only the current .dll and recycle the application pools with 1 click only (compared to CKSDev tools that will require at least 4 mouse clicks for the same):
    Step 1:  Create PowerShell script for deployment to GAC and app pool recycling. Let's name it RecycleCoreDLL.ps1 with the following code:

$appPoolName = "intranet.sharepointmasters.eu"
$appPool = get-wmiobject -namespace "root\MicrosoftIISv2" -class "IIsApplicationPool" | Where-Object {$_.Name -eq "W3SVC/APPPOOLS/$appPoolName"}
$appPool.Recycle()

& 'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\gacutil.exe' /u SharepointMasters.Portal.Core

& 'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\gacutil.exe' /i C:\Projects\SharepointMasters\SharepointMasters.Portal.Core\bin\Debug\SharepointMasters.Portal.Core.dll

& 'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\gacutil.exe' /u SharepointMasters.Portal

& 'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\gacutil.exe' /i C:\Projects\SharepointMasters\SharepointMasters.Portal\bin\Debug\SharepointMasters.Portal.dll

Here it is how it looks like:


All you need to change is the name of Application Pool and name of the assemblies. In this example I have 2 .DLL I want to deploy:
SharepointMasters.Portal.dll
SharepointMasters.Portal.Core.dll


    Step 2: create .bat file that will execute the PS script we just created. In my case I created   RecycleCore.bat with only 1 line in it:
         powershell.exe .\RecycleCoreDLL.ps1

That's it. Now  we have 1 click quick deployment