Thursday, August 21, 2008
Javascript to handle the on Enter button press event on the SharePoint Search control
string javascript = @"";
Monday, August 4, 2008
Tuesday, July 29, 2008
SharePoint Wild Card Search
This CoreResultsWebPart accepts Wild Card searches
http://www.codeplex.com/WildcardSearch/Release/ProjectReleases.aspx?ReleaseId=14207
http://www.codeplex.com/WildcardSearch/Release/ProjectReleases.aspx?ReleaseId=14207
Thursday, July 17, 2008
SPSecurity.RunWithElevatedPrivileges(delegate() .. error
I experienced an error while using SPSecurity.RunWithElevatedPrivileges(delegate() ... in my code.
Error message was : cannot convert from 'anonymous method' to 'Microsoft.SharePoint.SPSecurity.CodeToRunElevated'.
The problem was my return was inside the run with elevated privileges code. Once I took it out and placed it outside the run with elevated privileges code, the problem was fixed.
Error message was : cannot convert from 'anonymous method' to 'Microsoft.SharePoint.SPSecurity.CodeToRunElevated'.
The problem was my return was inside the run with elevated privileges code. Once I took it out and placed it outside the run with elevated privileges code, the problem was fixed.
Thursday, June 26, 2008
Saturday, June 7, 2008
Add a SharePoint security group through code
SPWeb web = SPContext.Current.Web
web.SiteGroups.Add("MySecurityGroup", web.CurrentUser, web.CurrentUser, "My own custom security group");
SPGroup myGroup = web.SiteGroups["MySecurityGroup"];
SPRoleAssignment roleAssignment = new SPRoleAssignment(myGroup);
SPRoleDefinition roleDefinition = site.RoleDefinition["Full Control"];
roleAssignment.RoleDefinitionBindings.Add(roleDefinition);
web.RoleAssignments.Add(roleAssignment);
web.SiteGroups.Add("MySecurityGroup", web.CurrentUser, web.CurrentUser, "My own custom security group");
SPGroup myGroup = web.SiteGroups["MySecurityGroup"];
SPRoleAssignment roleAssignment = new SPRoleAssignment(myGroup);
SPRoleDefinition roleDefinition = site.RoleDefinition["Full Control"];
roleAssignment.RoleDefinitionBindings.Add(roleDefinition);
web.RoleAssignments.Add(roleAssignment);
Sunday, June 1, 2008
SPGridView - Deleting a row
The signature of the Deleting event handler when u select the Delete link button :
private void gridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int rowIndex = e.RowIndex; // This gets you the row that u just clicked on the Delete button
GridViewRow row = gridView.Rows[rowIndex];
//To reference a particular column in that row, you can:
row.Cell[0].Text
// Where 0 is the reference to the first column in row.
//Since this gridview is binded to the datatable, just remove the row from the datatable and re bind to the grid view.
}
private void gridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int rowIndex = e.RowIndex; // This gets you the row that u just clicked on the Delete button
GridViewRow row = gridView.Rows[rowIndex];
//To reference a particular column in that row, you can:
row.Cell[0].Text
// Where 0 is the reference to the first column in row.
//Since this gridview is binded to the datatable, just remove the row from the datatable and re bind to the grid view.
}
Labels:
delete,
delete a row,
Deleting a row,
grid view,
SPGridView
SPGridView - Using a data table as the datasource
Loading a SPList of items into a datatable, then binding this datatable to the SPGridView.
SPGridView gridView = new SPGridView();
DataTable dt = new DataTable();
dt = new DataTable();
dt.Columns.Add("First Name");
dt.Columns.Add("Last Name");
dt.Columns.Add("Street Address");
dt.Columns.Add("Email Address");
foreach(SPListItem item in {insert SPList}.Items)
{
DataRow dr = dt.NewRow();
dr["First Name"] = item["First Name];
dr["Last Name"] = item["Last Name"];
dr["Street Address"] = item["Street Address"];
dr["Email Address"] = itemS["Email Address"];
dt.Rows.Add(dr);
}
gridView.DataSource = dt;
gridView.DataBind();
SPGridView gridView = new SPGridView();
DataTable dt = new DataTable();
dt = new DataTable();
dt.Columns.Add("First Name");
dt.Columns.Add("Last Name");
dt.Columns.Add("Street Address");
dt.Columns.Add("Email Address");
foreach(SPListItem item in {insert SPList}.Items)
{
DataRow dr = dt.NewRow();
dr["First Name"] = item["First Name];
dr["Last Name"] = item["Last Name"];
dr["Street Address"] = item["Street Address"];
dr["Email Address"] = itemS["Email Address"];
dt.Rows.Add(dr);
}
gridView.DataSource = dt;
gridView.DataBind();
Labels:
databinding,
datarow,
datatable,
gridview,
SPGridView
Attach an event handler to a specific list using a feature
Declare a normal feature with reference to a elements.xml

In this elements.xml, we have a and attribute. Ths ListTemplateId is necessary to define which list this event handler will be attached to.

In this elements.xml, we have a
Deploy a new List instance using a Feature
This feature is used to provision an instance of the Links list to a specified site on deployment via STSADM.

The {Guid} in this elements file is : 00BFEA71-2062-426C-90BF-714C59600103

The {Guid} in this elements file is : 00BFEA71-2062-426C-90BF-714C59600103
Deploy an Event Handler using a Feature for SPFeatureReceiver
To deploy a event handler that will be activated when the feature is activated (i.e. overriding the following methods : FeatureInstalled, FeatureUninstalling, FeatureActivated, FeatureDeactivating et .. what ever comes under the parent inheiritance from SPFeatureReceiver.
Put the Event Handler .dll into the Assembly (GAC) then create a feature to install it:

Put the Event Handler .dll into the Assembly (GAC) then create a feature to install it:

Saturday, May 31, 2008
Custom Web Part property : Drop down list
Create a user-defined enumeration method named CustomMode.
public enum CustomMode
{
Full,
Titles
}
Now create a custom property which will use our enumeration method:
private CustomMode displayMode= CustomMode.Full;
[Personalizable(PersonalizationScope.User), WebBrowsable(true), WebDisplayName("Display Mode"),
WebDescription("Which mode would u like to use to display the information?"),
Category("Custom Settings")]
public CustomMode DisplayMode{
get{return displayMode}
set{displayMode= value;}
public enum CustomMode
{
Full,
Titles
}
Now create a custom property which will use our enumeration method:
private CustomMode displayMode= CustomMode.Full;
[Personalizable(PersonalizationScope.User), WebBrowsable(true), WebDisplayName("Display Mode"),
WebDescription("Which mode would u like to use to display the information?"),
Category("Custom Settings")]
public CustomMode DisplayMode{
get{return displayMode}
set{displayMode= value;}
Add a Custom Property for a webpart
Declare a region called Web Part Properties and for each custom property, create an entry similar to the one below:
private string listName;
[Personalizable(PersonalizationScope.Shared),
WebDisplayName(true),
WebDisplayName("List Name"),
WebDescription("Set your list name you wish the webpart to read from"),
Category("Custom Settings")]
public string ListName
{
get{return listName;}
set{listName = value;}
}
private string listName;
[Personalizable(PersonalizationScope.Shared),
WebDisplayName(true),
WebDisplayName("List Name"),
WebDescription("Set your list name you wish the webpart to read from"),
Category("Custom Settings")]
public string ListName
{
get{return listName;}
set{listName = value;}
}
Thursday, May 22, 2008
Study notes 3
Site pages support user customisations. This brings performance concerns and security issues. Application pages does support customisations. Applications are allowed to have inline code.
Content types allow you to store multiple different types of content in one list or library. Content types bind a group of fields together. They are reusable, defines columns.
Content types allow you to store multiple different types of content in one list or library. Content types bind a group of fields together. They are reusable, defines columns.
Study notes 2
A Web Application is a IIS Web site specially configured to run WSS sites.
A site collection is a container of WSS sites. Each site collection requires a top level site.
A sub site are created under a site collection.
A web application is a container of site collections. A site collection is a container for sub sites.
Site collections provide scope for membership and security authorisation.
Site collections provide a convinient scope for backup and restore operations.
Features provide a mechanism for defining and adding site elements such as menu custom actions, web parts, and event handlers.
Application pool identity - Configured with a specific system account or domain account. When http.sys launches a new instance of the woker process w3wp.exe for a specific application pool, it uses the application pool identity to initialise a Window Security token that servces as a process token. It establishes the 'run as' identity for code that runs withing the IIS worker process.
When WSS converts an IIS Website into a Web application, it creates serval virtual directories. These are used by various aspects of the WSS runtime.
A site collection is a container of WSS sites. Each site collection requires a top level site.
A sub site are created under a site collection.
A web application is a container of site collections. A site collection is a container for sub sites.
Site collections provide scope for membership and security authorisation.
Site collections provide a convinient scope for backup and restore operations.
Features provide a mechanism for defining and adding site elements such as menu custom actions, web parts, and event handlers.
Application pool identity - Configured with a specific system account or domain account. When http.sys launches a new instance of the woker process w3wp.exe for a specific application pool, it uses the application pool identity to initialise a Window Security token that servces as a process token. It establishes the 'run as' identity for code that runs withing the IIS worker process.
When WSS converts an IIS Website into a Web application, it creates serval virtual directories. These are used by various aspects of the WSS runtime.
My Study Notes
WSS 3.0 offers all the standard site templates to build blank sites, blogs, wikis and other work spaces. Version control, task notification and alerts all come with WSS 3.0. WSS is included as a part of the Windows Server 2003 operating system.
MOSS offers all of the features included in WSS 3.0. In addition, MOSS 2006 offers business intelliegence features that allow you to track key performance indicators. MOSS offers all the features of WSS but enhances and extends them while also adding new functionality.
Main differences:
- Personalisation: MOSS allows users to have individual, personalised sites; WSS doesn't.
- Audience Targeting - MOSS allows you to target content to specific user groups; WSS doesn't
- Search administration and customization - MOSS gives its administrators much more control over the configuration of its search engine; WSS doesn't.
- User Profiles: MOSS allows you to import, store, and update personal data on your users; its not available in WSS.
- MOSS allows all of the content in multiple site collections to be crawled and indexed, then made available in a centralised search site.
MOSS offers all of the features included in WSS 3.0. In addition, MOSS 2006 offers business intelliegence features that allow you to track key performance indicators. MOSS offers all the features of WSS but enhances and extends them while also adding new functionality.
Main differences:
- Personalisation: MOSS allows users to have individual, personalised sites; WSS doesn't.
- Audience Targeting - MOSS allows you to target content to specific user groups; WSS doesn't
- Search administration and customization - MOSS gives its administrators much more control over the configuration of its search engine; WSS doesn't.
- User Profiles: MOSS allows you to import, store, and update personal data on your users; its not available in WSS.
- MOSS allows all of the content in multiple site collections to be crawled and indexed, then made available in a centralised search site.
Wednesday, May 14, 2008
Not able to join all .001, .002, etc files with HJ-SPLIT
After downloading .001, .002, and so on, you proceed to use HJ-SPLIT to join the files.
In some situations, you may face an error and the joing process will either not work or will only join some of the files.
1. Make sure you have all the files you require, i.e .001 to 0.010
2. Right click on each of these files and check the Properties. Ensure that you select "Un Block" for each one of these files on the properties screen. This blocking mechanism occurs on XP SP2, not sure if it does on other OSystems.
3. Join again.
4. Make sure the result file is the same size as the sum of all the .001, .002 etc files sizes altogether.
In some situations, you may face an error and the joing process will either not work or will only join some of the files.
1. Make sure you have all the files you require, i.e .001 to 0.010
2. Right click on each of these files and check the Properties. Ensure that you select "Un Block" for each one of these files on the properties screen. This blocking mechanism occurs on XP SP2, not sure if it does on other OSystems.
3. Join again.
4. Make sure the result file is the same size as the sum of all the .001, .002 etc files sizes altogether.
Subscribe to:
Comments (Atom)
.jpg)
