Tuesday, October 27, 2009

MOSS/WSS3.0 DISASTER RECOVERY STEPS

http://sharepointmadeeasy.blogspot.com/2009/01/mosswss30-disaster-recovery-steps.html

Friday, October 17, 2008

MOSS WebPart Property Attributes

SharePoint WebPart Property Attributes
I wanted to put this information out there because it was not well published when I was building WebParts for the first time. When you build a WebPart in MOSS 2007 you have the ability to expose the public properties of the WebPart in the editor pane of the WebPart page. This allows you to set some administrative values for the WebPart behind the scenes. In order to make this happen you have to tag the property as being Web Browsable.

Unfortunately most of the documentation only gives information on the WebBrowsable and Personalizable attributes. However there are a few others that you might find valuable to know about. Some of the other attributes are listed below along with explanations and links to further resources.

WebBrowsable [WebBrowsable(True)]
"Indicates whether the designated property of a Web Parts control is displayed in a PropertyGridEditorPart object." (MSDN)
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.webbrowsableattribute.aspx

WebPartStorage [WebPartStorage(Storage.Personal)]
This attribute specifies what type of storage options the WebPart will make use of. The most common is Storage.Personal. "This property can be personalized by individual users. Its WebPartStorageAttribute value is Storage.Personal, which specifies that the property can be stored on a per-user basis. Only users with the Personalize Web Part pages right can set this property." (MSDN)
http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.webpartpages.webpartstorageattribute.aspx

Personalizable [Personalizable(true)]

Allows users the ability to personalize settings for the WebPart.
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.personalizableattribute.aspx

WebDispayName [WebDisplayName(string)]
Defines the Friendly Name for a property of a WebPart control. This is the name that will show up in the editor screen.
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.webdisplaynameattribute.aspx

WebDescription [WebDescription(string)]
Defines the string value to use as a ToolTip for a property of a Web Parts control. (MSDN)
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.webdescriptionattribute.aspx

SPWebCategoryName [SPWebCategoryName(string)]
Defines the friendly or localized name of the category of a property in the CustomPropertyToolPartcontrol inside the ToolPane.
http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.webpartpages.spwebcategorynameattribute.aspx

ConnectionProvider [ConnectionProvider(string)]
Identifies the callback method in a server control acting as the provider in a Web Parts connection, and enables developers to specify details about the provider's connection point. (MSDN) This is used to create connectable WebParts.
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.connectionproviderattribute.aspx

ConnectionConsumer [ConnectionConsumer(string)]
Identifies the callback method in a server control acting as the consumer in a Web Parts connection, and enables developers to specify details about the consumer's connection point. (MSDN) This is used to create connectable WebParts.
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.connectionconsumerattribute.aspx

Below is an example of how to use these attributes in your WebPart code.

[WebBrowsable(true),
Personalizable(false),
WebPartStorage(Storage.Personal),
WebDisplayName("TestDisplayName)"),
WebDescription("Test Description
SPWebCategoryName("Options")]
public string HellWorld
{
get { return _HelloUser; }
set { _HelloUser= value; }
}

Wednesday, October 15, 2008

How to add flash (swf) file in MOSS 2007 from You Tube

To Add a flash file in ur sharepoint site from you tube, Copy embed from you tube
and paste it in to source of a Content Editor web part.

Note: u must be connected to internet to view the flash video...
Happy Watchings...

Tuesday, October 14, 2008

Various Accounts in MOSS 2007

The following covers the most common service accounts that need to be setup and their typical permissions in order for MOSS to function properly. Note that each deployment is different, so these accounts may differ based upon individual requirements. There are some additional accounts that you may need for other optional services, but they are not mentioned here.
Running MOSS Setup
On every server where MOSS is to be installed, the account you run setup with must belong to the local administrators group. In addition, this account must be a Domain User and be a member of the following SQL server security roles: Logins, Securityadmin & Dbcreator. This account is going to be doing a lot – creating new databases, and also creating new IIS sites – so make sure you have enough permissions! Typically, an account such as the domain administrator is used to run the installation, which addresses all of the security requirements.
SQL Server (SQL_Service)
This account is specified when a new SQL server is being brought online or a new instance installed. It typically is used for running both the SQL Server & SQL Server Agent, however, each can have their own account. For our purposes, we will utilize one account for both SQL Server & the Agent. The account only needs to be a basic Domain Account with no specific permissions set. When SQL Server is installed, all of the other appropriate permissions will be granted to the account.
Database Access Account / Farm Account (Farm_Service)
This account serves a few roles. The first is that it is used by MOSS to access the databases… it acts as the account by which the server(s) MOSS is installed on communicates back and forth to SQL with (read/write). Additionally, it is used as the identity for the Central Administration application pool & the WSS Timer service. This account needs to be a Domain Account - but note that it is believed to have to be a local admin on every MOSS box - this is not true, as Spence points out very eloquently.
Shared Service Provider (SSP#_Service)
Each shared service provider can run under its own account, therefore, it is desirable to name the account using a number. This way, if your MOSS farm ends up having a large number of SSPs, you can map the SSPs back to their specific service accounts easily. This account is used for the SSP web services & the SSP timer jobs. The account only needs to be a basic Domain Account with no specific permissions set.
Office SharePoint Server Search (Search_Service)
This account is utilized by all of the Shared Service Provider to crawl local & remote content. This account should be a Domain Account & have local administrator permissions on each MOSS server.
Default Content Access Account (SSP#ContentAccess_Service)
When a shared service provider crawls content, this is the default account used if a specific account (see below) is not specified for the content source being crawled. This account is specific for each individual SSP. This account should be a Domain Account & have read access to the content sources it needs to crawl.
Content Access Account (XXXXContent_Service)
If you have specific content sources that need to be crawled, and you do not want to allow the default content access account to crawl them, then you specify an individual content access account (specified at the time a Crawl Rule is setup). This account is a Domain Account with read permissions specifically on the content source it crawls.
Windows SharePoint Services Search Account (WSSSearch_Service)
The WSS Services Search is used only to provide search capabilities within the Help content. If this search feature is desired, then this account should be configured as a Domain Account with no specific permissions.
Application Pool Process Account (XXXXPool_Service)
When each application pool is setup, you must specify an account that will be used for that specific application pool’s identity. This account will be used to access the content databases associated with the web application. It is recommended that a new service account is created for each application pool. This should be a Domain Account with no specific permissions. When the account is specified & SharePoint creates the application pool, it automatically grants the account additional needed permissions.
For more pls Visit : http://technet.microsoft.com/en-us/library/cc263445.aspx

Thursday, October 9, 2008

Custom Calendar for MOSS 2007

using System;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebPartPages;

namespace CalendarWebPart
{
///
/// Description for CalControl.
///

[DefaultProperty("Text"),
ToolboxData("<{0}:CalControl runat=server>"),
XmlRoot(Namespace = "CalControl")]
public class CalControl : Microsoft.SharePoint.WebPartPages.WebPart
{
Calendar NewCalendar = new Calendar();
Label lblMessage = new Label();
//string strCommonUrl = null;
//bool CommonFlag = false;
HyperLink lbl;
private const string defaultText = "";
private string _text = string.Empty;
private string _col = string.Empty;
public CalControl()
{
try
{
specifyColors();
this.Controls.Add(NewCalendar);
this.Controls.Add(lblMessage);
this.NewCalendar.SelectionChanged += new EventHandler(NewCalendar_SelectionChanged);

}
catch (Exception Ex)
{
lblMessage.Text = "Problems while loading the page. " + Ex.Message.ToString();
}
}

protected void specifyColors()
{
NewCalendar.BackColor = System.Drawing.Color.FromName("#f9f9f9");

NewCalendar.ForeColor = System.Drawing.Color.FromName("#444444");

NewCalendar.TitleStyle.BackColor = System.Drawing.Color.White;

NewCalendar.NextPrevStyle.BackColor = System.Drawing.Color.FromName("#f9f9f9");

NewCalendar.TitleStyle.ForeColor = System.Drawing.Color.FromName("#252525");

NewCalendar.TitleStyle.Font.Bold = true;

NewCalendar.DayHeaderStyle.BackColor = System.Drawing.Color.FromName("#fdd127");

NewCalendar.DayHeaderStyle.ForeColor = System.Drawing.Color.FromName("#08204a");

NewCalendar.TodayDayStyle.BackColor = System.Drawing.Color.FromName("#c9ccd1");

NewCalendar.NextPrevStyle.ForeColor = System.Drawing.Color.FromName("#252525");
NewCalendar.NextPrevStyle.Font.Bold = true;

NewCalendar.Height = new Unit(150);
NewCalendar.Width = new Unit(216);

NewCalendar.OtherMonthDayStyle.ForeColor = System.Drawing.Color.FromName("#d3d3d4");

NewCalendar.SelectedDayStyle.ForeColor = System.Drawing.Color.FromName("#ff3000");
NewCalendar.SelectorStyle.BackColor = System.Drawing.Color.FromArgb(255, 204, 102);

NewCalendar.ShowGridLines = false;

NewCalendar.BorderColor = System.Drawing.Color.FromName("#d6d6d6");
NewCalendar.WeekendDayStyle.ForeColor = System.Drawing.Color.FromName("#ff3000");
//NewCalendar.OtherMonthDayStyle.ForeColor = System.Drawing.Color.FromArgb(231, 240, 253);

}

private string text = defaultText;

[Browsable(true),
Category("Miscellaneous"),
DefaultValue(defaultText),
WebPartStorage(Storage.Shared),
FriendlyName("Text"),
Description("Text Property")]
public string Text
{
get
{
return text;
}

set
{
text = value;
}
}

[Browsable(true),
Category("Event"),
DefaultValue(defaultText),
WebPartStorage(Storage.Shared),
FriendlyName("Event"),
Description("Event")]
[XmlElement(ElementName = "Event")]
public string Event
{
get
{
return _text;
}

set
{
_text = value;
}
}

[Browsable(true),
Category("Event"),
DefaultValue(defaultText),
WebPartStorage(Storage.Shared),
FriendlyName("Column"),
Description("Column")]
[XmlElement(ElementName = "Column")]
public string Column
{
get
{
return _col;
}

set
{
_col = value;
}
}

///
/// This method gets the custom tool parts for this Web Part by overriding the
/// GetToolParts method of the WebPart base class. You must implement
/// custom tool parts in a separate class that derives from
/// Microsoft.SharePoint.WebPartPages.ToolPart.
///

///An array of references to ToolPart objects.
// public override ToolPart[] GetToolParts()
// {
// ToolPart[] toolparts = new ToolPart[2];
// WebPartToolPart wptp = new WebPartToolPart();
// CustomPropertyToolPart custom = new CustomPropertyToolPart();
// toolparts[0] = wptp;
// toolparts[1] = custom;
// return toolparts;
// }

///
/// Render this Web Part to the output parameter specified.
///

/// The HTML writer to write out to
protected override void RenderWebPart(HtmlTextWriter output)
{
try
{
SPWeb spwCurr = Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(Context);
output.Write(SPEncode.HtmlEncode(Text));

if (this.Event.ToString().TrimStart().TrimEnd().Equals(""))
{
this.lblMessage.Text = "Please provide the Events name in Properties";
}

/// Table Starts
output.Write("");

output.Write("");

//output.Write("");
// output.Write("");
//output.Write("");

//output.Write("");
// output.Write("");
//output.Write("");

output.Write("");
output.Write("");
output.Write("");

output.Write("");
output.Write("");
output.Write("");



output.Write("
");
NewCalendar.RenderControl(output);
output.Write("
");
// output.Write("Birthday");
// output.Write("
");
// output.Write("Holiday");
// output.Write("
");
output.Write("");
output.Write("
");
lblMessage.RenderControl(output);
output.Write("
");

}
catch (Exception Ex)
{
lblMessage.Text = "Error while rendering the web part. " + Ex.Message.ToString();
}
}

protected override void CreateChildControls()
{
try
{
NewCalendar.DayRender += new DayRenderEventHandler(NewCalendar_DayRender);
}
catch (Exception Ex)
{
this.lblMessage.Text = "Problems while Creating child Controls. " + Ex.Message.ToString();
}
}

private void NewCalendar_SelectionChanged(object sender, EventArgs e)
{
if (NewCalendar.SelectedDates.Count > 0)
{
// this.Page.Response.Redirect(lbl.NavigateUrl.ToString());

}
}
private void NewCalendar_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
{
try
{
e.Day.IsSelectable = false;
if (!(e.Day.IsOtherMonth))
{
SPWeb spwCurr = Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(Context);
Microsoft.SharePoint.SPList list;


try
{
list = spwCurr.Lists[this.Event.ToString().TrimStart().TrimEnd()];
}
catch
{
throw new Exception("Please specify a valid Events Name in the WebPart Properties");
}

string strEventInternal = list.DefaultViewUrl.ToString();
strEventInternal = strEventInternal.Remove(strEventInternal.Length - 14, 14);
strEventInternal = strEventInternal.Remove(0, strEventInternal.LastIndexOf("/") + 1);

DateTime start;
string strFUrl = spwCurr.Url.ToString() + "/Lists/" + strEventInternal + "/DispForm.aspx?ID=";
string strID = "0";
string strRUrl = "&Source=" + spwCurr.Url.ToString() + "/Lists/" + strEventInternal + "/AllItems.aspx";

string strUrlF = spwCurr.Url.ToString() + "/Lists/" + strEventInternal + "/calendar.aspx?CalendarDate=";
string strDate = "0";
string strUrlR = "&View={4FF74E9E-B137-4E79-8DA7-AACF7D9CC7C4}&CalendarPeriod=day";

lbl = new HyperLink();
lbl.Text = "*";
lbl.Font.Bold = true;

foreach (Microsoft.SharePoint.SPListItem item in list.Items)
{
try
{
start = DateTime.Parse(item[this.Column.ToString()].ToString());
}
catch (Exception Ex)
{
//throw new Exception("Please specify a valid column name (start/end) date");
throw new Exception(Ex.Message.ToString());
}

if (start.ToShortDateString() == e.Day.Date.ToShortDateString())
{
strID = item.ID.ToString();
e.Cell.ToolTip += "\n" + "* " + item["LinkTitle"].ToString();

string dat = start.ToShortDateString().ToString();
string year = start.Date.Year.ToString();
string month = start.Date.Month.ToString();
string date = start.Date.Day.ToString();

strDate = year.ToString() + "-" + month.ToString() + "-" + date.ToString();

e.Cell.BackColor = System.Drawing.Color.FromName("#ff9e18");//AAD423

try
{
// if(item["Birthday"].ToString().Equals("True"))
// {
// e.Cell.BackColor = System.Drawing.Color.FromArgb(255, 210, 250);
// }
// if(item["Holiday"].ToString().Equals("True"))
// {
// e.Cell.BackColor = System.Drawing.Color.FromArgb(255, 188, 188);
// }

if (e.Cell.Controls.Count == 1)
{
e.Day.IsSelectable = true;
lbl.NavigateUrl = strFUrl + strID + strRUrl;
e.Cell.Controls.Add(lbl);
}
else if (e.Cell.Controls.Count > 1)
{
e.Day.IsSelectable = true;
lbl.NavigateUrl = strUrlF + strDate + strUrlR;
}
}
catch
{
throw new Exception("Birthday, Holiday field is missing. Please insert the same");
}
}
}
}
}
catch (Exception Ex)
{
lblMessage.Text = Ex.Message.ToString();
}
}
}
}