2010年8月20日 星期五

How to change SharePoint view to click title and enter edit mode

​Open your view in SPD, find these code:

<xsl:otherwise>
                <xsl:choose>
                      <xsl:when test="$XmlDefinition/List/@TemplateType != 301">
                  <a onfocus="OnLink(this)" href="{$FORM_DISPLAY}&amp;ID={$ID}&amp;ContentTypeID={$thisNode/@ContentTypeId}" onclick="EditLink2(this,{$ViewCounter});return false;" target="_self">
                          <xsl:call-template name="LinkTitleValue.LinkTitle">
                            <xsl:with-param name="thisNode" select="$thisNode"/>
                            <xsl:with-param name="ShowAccessibleIcon" select="$ShowAccessibleIcon"/>
                         </xsl:call-template>
                  </a>
              </xsl:when>
                      <xsl:otherwise>
                    <a onfocus="OnLink(this)" href="{$FORM_DISPLAY}&amp;ID={$ID}" onclick="GoToLink(this);return false;" target="_self">
                          <xsl:call-template name="LinkTitleValue.LinkTitle">
                            <xsl:with-param name="thisNode" select="$thisNode"/>
                            <xsl:with-param name="ShowAccessibleIcon" select="$ShowAccessibleIcon"/>
                         </xsl:call-template>
                  </a>
              </xsl:otherwise>


change to these code:

<xsl:otherwise>
                <xsl:choose>
                      <xsl:when test="$XmlDefinition/List/@TemplateType != 301">
                  <a onfocus="OnLink(this)" href="{$FORM_EDIT}&amp;ID={$ID}&amp;ContentTypeID={$thisNode/@ContentTypeId}" onclick="EditLink2(this,{$ViewCounter});return false;" target="_self">
                          <xsl:call-template name="LinkTitleValue.LinkTitle">
                            <xsl:with-param name="thisNode" select="$thisNode"/>
                            <xsl:with-param name="ShowAccessibleIcon" select="$ShowAccessibleIcon"/>
                         </xsl:call-template>
                  </a>
              </xsl:when>
                      <xsl:otherwise>
                    <a onfocus="OnLink(this)" href="{$FORM_EDIT}&amp;ID={$ID}" onclick="GoToLink(this);return false;" target="_self">
                          <xsl:call-template name="LinkTitleValue.LinkTitle">
                            <xsl:with-param name="thisNode" select="$thisNode"/>
                            <xsl:with-param name="ShowAccessibleIcon" select="$ShowAccessibleIcon"/>
                         </xsl:call-template>
                  </a>
              </xsl:otherwise>

2010年3月30日 星期二

Visual Studio 2010 SharePoint project error - The language-neutral solution package was not found

We sometimes get this error when deploying SharePoint 2010 solutions from Visual Studio 2010:

Error occurred in deployment step ‘Retract Solution’: The language-neutral solution package was not found.

You can run get-spsolution powershell command without parameters to see which solutions are currently installed in the farm.Therefore you can use this powershell command to delete this solution manually:

(get-spsolution mysolution.wsp).Delete()


After you run this command, you can test your SharePoint 2010 solution in Visual Studio 2010 environment.

2010年3月28日 星期日

How to add solution file (.wsp) to SharePoint 2010

In SharePoint 2007, we use stsadm to config SharePoint. Now we need to use powershell to set configuration in 2010.

If we need to add a solution file to SharePoint 2007, we use stsadm command as following:
stsadm –o addsolution –name SharePointProject.wsp

In SharePoint 2010, the powershell command is as following:

Add-SPSolution c:\SharePointProject.wsp

In this case you don’t actually have to type –literalpath before the parameter. This is what it looks like when executed. You can see that it displays the id of the solution along with its deployment status.

PowerShellAddSolution


After you add solution package to server farm, you can deploy in central administartion->System setting->farm solution management.

If you retract your solution fail by central administration page, you can use power shell tool to retract your solution. However, powershell doesn't have retract command anymore. Please use uninstall.

Uninstall-SPSolution –Identity SharePointProject.wsp –WebApplication http://sp2010

If you just need to update your solution file, you can use this code as following:

Update-SPSolution –Identity SharePointProject.wsp –LiteralPath c:\SharePointProject.wspGACDeployment

2010年3月21日 星期日

Custom form fields of a SharePoint list

It’s the ability to edit and customize the default form fields for any list.When you open a form in SharePoint list, you'd like to see this form filed at default:

You're not able to see the filed in this list. If you want to set some field as hidden or readonly, how to do this task?
  1. Open this form and select a area that you want to put form field.
  2. Click Insert->SharePoint Controls->Custom List Form
  3. Choose List or Document Library Form you'd like to display

  4. This form's field will showed in this page. You can edit properties in this page.

  5. Select the original form ListFormWebPart property, tick hidden in layouts section.


Sharepoint designer cannot create workflows: "access denied"

Condition:
You're a site owner and you want to create a workflow in your site, but get error:Access denied.

Solution:
Make sure you have site collection administrator permission or contact your site collection administration.

  1. Open your site by SharePoint Designer.
  2. Right click Workflow node in Folder list and select "Properties."


  3. Select "Manage permission using the browser" in security tab.