Posts mit dem Label SharePoint 2010 werden angezeigt. Alle Posts anzeigen
Posts mit dem Label SharePoint 2010 werden angezeigt. Alle Posts anzeigen

Freitag, 16. November 2012

Hide the title column in a custom content type

One of the problem which I had most of the time when I tried to create a custom content type was "How can I hide title column in my custom conten type?"

The Solution is very easy. You must break the Inherits from item and add RemoveFieldRef to your content type definition :-).

Hier is a code example which can you use as an example for you:

<pre class="brush: xml">// Comment
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <!-- Parent ContentType: Item (0x01) -->
  <ContentType ID="0x01006ffb64509c2341d2bff13b98859f792b" Name="MyTestCT" Description="My Content Type" Inherits="FALSE" Version="0">
    <FieldRefs>
      <RemoveFieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" />
      <FieldRef ID="{38B8C4D9-6048-44A3-A092-BB11DD7F6861}"  Name="MyNewfield" Required="TRUE"></FieldRef>
    </FieldRefs>
  </ContentType>
  <Field ID="{38B8C4D9-6048-44A3-A092-BB11DD7F6861}" Name="MyNewfield" Group="My Cloumns" DisplayName="My New Field" Description="My New Field" Type="Text" Required="TRUE"/> 
</Elements>
</pre>

Montag, 22. Oktober 2012

Debugging SharePoint 2010

Turning off custom errors in _layouts Web.Config for debugging mode in SharePoint 2010


As a developer, one of the first things I do after I have setup a web application & site collection is:
Open the web.config (“C:\inetpub\wwwroot\wss\VirtualDirectories\<port>”) and set:

- Debug=”true” instead of the default of Debug=”false” (I do a find on “debug” in Visual Studio)
- CallStack=”true” instead of the default of CallStack=”false” (I do a find on “callstack” in Visual Studio)
- CustomErrors=”Off” instead of the default of CustomErrors=”On” (I do a find on “CustomErrors” in Visual Studio)
I would have expected this to be enough to catch all errors but when I tried to delete a content type that was probably in use, instead of getting the detailed message I was expecting, I ended up getting the infamous message telling me to change the customerrors setting in the web.config so that I can see the details:

Server Error in '/' Application.

--------------------------------------------------------------------------------
Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed.
Details: To enable the details of this specific error message to be viewable on the local server machine, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "RemoteOnly". To enable the details to be viewable on remote machines, please set "mode" to "Off".

image

As a refresher to anyone else that is running into this problem, there is another web.config in the _layouts directory (“C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14”) where you need to turn the customErrors to be “Off”:

Dienstag, 7. August 2012

Delete Column from a SharePoint List



If you want to delete a column from a SharePoint List. Following steps on powershel can help you well.

PS> $web = Get-SPWeb -identity http://your/site/name
PS> $list = $web.Lists["Your List Name"]
PS> $column = $list.Fields["Your Column Name"]
PS> $column.Hidden = $false
PS> $column.ReadOnlyField = $false
PS > $column.Update()
PS > $list.Fields.Delete($column)

Donnerstag, 2. August 2012

Install-SPSolution Error

Install-SPSolution: Admin SVC must be running in order to create deployment timer job


When I was trying to deploy the SharePoint 2010 WSP on another server using PowerShell, I got this error when I tried to run the Install -SPSolution command saying that:
Install-SPSolution: Admin SVC must be running in order to create deployment timer job


So all you need to do is to go to the Services section in Administrative Tools and look for the service called SharePoint 2010 Administration, it was on manual start up, changed it to automatic and started it and gotten rid of this error.

The content type is part of an application feature

Recently I had the problem in a production environment that after the deactivation of a feature I was not able to delete the content ty...