Monday, May 31, 2010

Using SharePoint Calculated Columns to Display Current Month List Items


  1. Created First Day Of Month

    =DATE(YEAR([Created]),MONTH([Created]),1)

  2. Created Last Day Of Month

    =DATE(YEAR([Created]),MONTH([Created])+1,1)-1

I then added the below filters to view:



Richtextbox in sharepoint

<%@ Register TagPrefix="SharePointSD" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>


<SharePointSD:InputFormTextBox runat="server" ID="RichTextBox" ValidationGroup="CreateCase" Rows="8" Columns="40" RichText="true" RichTextMode="FullHtml" AllowHyperlink="true" TextMode="MultiLine" />

Sunday, May 30, 2010

Microsoft.SharePoint.SPListItem.PrepareItemForUpdate + SPWorkflowTask.AlterTask + Task not updated

Hi Guys,

Today I have tried to updated task list item in workflow but everytime i was getting Microsoft.SharePoint.SPListItem.PrepareItemForUpdate error when updated item.

I have used taskcontenttype for aspx task form in my workflow. I have updated task using SPWorkflowTask.AlterTask but not solved my problem.

Solution :

Put FieldRefs in contentType XML.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ContentType ID="0x01080100DB4541EA29924902A6635A9D335C698B"
Name="SOP Issue WF Content Type1"
Group="SOP Issue"
Description="SOP Issue WF Content Type Task"
Version="0"
Hidden="FALSE">
<FieldRefs>

</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<FormUrls xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<New>_layouts/SOPIssueWF/Task1EditForm.aspx</New>
<Display>_layouts/SOPIssueWF/Task1EditForm.aspx</Display>
<Edit>_layouts/SOPIssueWF/Task1EditForm.aspx</Edit>
</FormUrls>
</XmlDocument>
</XmlDocuments>
</ContentType>
</Elements>


Thursday, May 27, 2010

How to get current logged in user in sharepoint object model

using (SPSite site = new SPSite(SPContext.Current.Web.Url.ToString()))
{
using (Microsoft.SharePoint.SPWeb web1 = site.OpenWeb())
{
using (Microsoft.SharePoint.SPWeb web = SPControl.GetContextWeb(Context))

{

SPUser currentuser = web.CurrentUser;

}
}
}

Tuesday, May 18, 2010

MOSS 2007 Problem : Cannot connect to the configuration database.

Hi Guys,

During my work with MOSS 2007,i had some performance issues regarding the SQL Server instance services which is running the configuration and Data for MOSS sites.

I had closed this service bymistake and when i'm trying to open the central administration site or any site i got this message in the IR:

"Cannot connect to the configuration database."

To resolve this : go to your services and start this service:
"SQL Server (MSSQLSERVERS)"

This Tip is enough to continue your work with your MOSS sites.

Hope this helps