In order to resolve this error "The search request was unable to connect to the Search Service.":
1. Go to the server:
Run > Type “Services.msc” - >
- Start a SharePoint search service;
- Start Indexing service;
- IISReset
Saturday, January 24, 2009
Friday, January 23, 2009
Sharepoint Service Error: A deployment or retraction is already under way for the solution *.wsp
Sharepoint Service Error: A deployment or retraction is already under way for the solution *.wsp
To resolve this problem do the next steps:
Click "Start", click "Run" type cmd
The operation below shows you all runnig deploying process:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>stsadm -o enumdeployments
Base on GUI of process you can cancel it. Use next operation for that:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>stsadm -o canceldeployment -id "GUID job ID"
To resolve this problem do the next steps:
Click "Start", click "Run" type cmd
The operation below shows you all runnig deploying process:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>stsadm -o enumdeployments
Base on GUI of process you can cancel it. Use next operation for that:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>stsadm -o canceldeployment -id "GUID job ID"
Tuesday, January 13, 2009
Setting Unique Folder Permissions
SPPrincipal principal = userToAdd;
SPFolderCollection submissions = web.GetFolder("Submissions").SubFolders;
SPFolder newFolder = submissions.Add("testfolder");
SPListItem folderItem = newFolder.Item;
folderItem.BreakRoleInheritance(true);
folderItem.Update();
SPRoleAssignment folderRoleAssignment = new SPRoleAssignment(principal); SPRoleAssignmentCollection folderRoleAssignments = folderItem.RoleAssignments; SPRoleDefinitionBindingCollection folderRoleDefBindings = folderRoleAssignment.RoleDefinitionBindings;
folderRoleDefBindings.Add(roleDefinitions["Contribute"]);
folderRoleAssignments.Add(folderRoleAssignment);
SPFolderCollection submissions = web.GetFolder("Submissions").SubFolders;
SPFolder newFolder = submissions.Add("testfolder");
SPListItem folderItem = newFolder.Item;
folderItem.BreakRoleInheritance(true);
folderItem.Update();
SPRoleAssignment folderRoleAssignment = new SPRoleAssignment(principal); SPRoleAssignmentCollection folderRoleAssignments = folderItem.RoleAssignments; SPRoleDefinitionBindingCollection folderRoleDefBindings = folderRoleAssignment.RoleDefinitionBindings;
folderRoleDefBindings.Add(roleDefinitions["Contribute"]);
folderRoleAssignments.Add(folderRoleAssignment);
Adding User to a SharePoint Group
web.AllowUnsafeUpdates = true;
SPGroup studentsGroup = web.Groups["Students"];
SPUser userToAdd = web.SiteUsers["pilothouse\\testgroup"];
studentsGroup.AddUser(userToAdd);
Response.Write("Added user successfully");
SPGroup studentsGroup = web.Groups["Students"];
SPUser userToAdd = web.SiteUsers["pilothouse\\testgroup"];
studentsGroup.AddUser(userToAdd);
Response.Write("Added user successfully");
Role Assignments For the Site
SPRoleAssignmentCollection webRoleAssignments =
web.RoleAssignments;
Response.Write("All role assignments in this site: " + "
");
foreach (SPRoleAssignment webRoleAssignment in webRoleAssignments)
{
Response.Write(webRoleAssignment.Member.Name + " "
+ webRoleAssignment.RoleDefinitionBindings[0].Name + " "
+ webRoleAssignment.Parent.ToString() + "
");
}
web.RoleAssignments;
Response.Write("All role assignments in this site: " + "
");
foreach (SPRoleAssignment webRoleAssignment in webRoleAssignments)
{
Response.Write(webRoleAssignment.Member.Name + " "
+ webRoleAssignment.RoleDefinitionBindings[0].Name + " "
+ webRoleAssignment.Parent.ToString() + "
");
}
Role Definitions
// Role definitions are represented as "Permissions Levels"
// in user interface
SPRoleDefinitionCollection roleDefinitions = web.RoleDefinitions;
Response.Write("All role definitions in this site: " + "
");
foreach (SPRoleDefinition roleDefinition in roleDefinitions)
{
Response.Write(roleDefinition.Name + "
");
}
// in user interface
SPRoleDefinitionCollection roleDefinitions = web.RoleDefinitions;
Response.Write("All role definitions in this site: " + "
");
foreach (SPRoleDefinition roleDefinition in roleDefinitions)
{
Response.Write(roleDefinition.Name + "
");
}
SharePoint Group Users
// All users in "Students" SharePoint group
users = web.Groups["Students"].Users;
Response.Write("All users in \"Students\" SharePoint group: " + "
");
foreach (SPUser user in users)
{
Response.Write(user.Name + "
");
}
users = web.Groups["Students"].Users;
Response.Write("All users in \"Students\" SharePoint group: " + "
");
foreach (SPUser user in users)
{
Response.Write(user.Name + "
");
}
SharePoint Group Security Principals
// SharePoint Groups that are Security Principals on this website
SPGroupCollection groups = web.Groups;
Response.Write("All SharePoint groups in this site: "+"
");
foreach (SPGroup group in groups)
{
Response.Write(group.Name + "
");
}
// All SharePoint Groups in this site collection
groups = web.SiteGroups;
Response.Write("All SharePoint groups in this site collection: " + "
"); foreach (SPGroup group in groups)
{
Response.Write(group.Name + "
");
}
SPGroupCollection groups = web.Groups;
Response.Write("All SharePoint groups in this site: "+"
");
foreach (SPGroup group in groups)
{
Response.Write(group.Name + "
");
}
// All SharePoint Groups in this site collection
groups = web.SiteGroups;
Response.Write("All SharePoint groups in this site collection: " + "
"); foreach (SPGroup group in groups)
{
Response.Write(group.Name + "
");
}
Domain User and Group Security Principals
// All domain users and groups
// that are Security Principals for the website
// This is the list you see in /_layouts/user.aspx
SPUserCollection users = web.Users;
Response.Write("All domain user principals in this site: " + "
");
foreach (SPUser user in users)
{
Response.Write(user.Name + "
");
}
// All domain users and groups within the site collection
users = web.SiteUsers;
Response.Write("All users in this site collection: " + "
");
foreach (SPUser user in users)
{
Response.Write(user.Name + "
" );
}
// that are Security Principals for the website
// This is the list you see in /_layouts/user.aspx
SPUserCollection users = web.Users;
Response.Write("All domain user principals in this site: " + "
");
foreach (SPUser user in users)
{
Response.Write(user.Name + "
");
}
// All domain users and groups within the site collection
users = web.SiteUsers;
Response.Write("All users in this site collection: " + "
");
foreach (SPUser user in users)
{
Response.Write(user.Name + "
" );
}
Security Permission Inheritance
SPSite site = SPContext.Current.Site;
SPWeb web = SPContext.Current.Web;
// Test to see if the site has unique permissions
if (web.HasUniqueRoleAssignments)
{
Response.Write(web.Title + " does not inherit permissions
" );
}
else
{
Response.Write(web.Title + " inherits permissions
" );
}
SPWeb web = SPContext.Current.Web;
// Test to see if the site has unique permissions
if (web.HasUniqueRoleAssignments)
{
Response.Write(web.Title + " does not inherit permissions
" );
}
else
{
Response.Write(web.Title + " inherits permissions
" );
}
Monday, January 12, 2009
Uncustomized and Customized Pages
Ghosted - Uncustomized
Unghosted - Customized
In WSS v3 pages exist in one of two states: customized or uncustomized. An uncustomized page is one that is listed in the site's contents database, but the actual source of the page (the file) resides on the file system, and the content database simply contains a link pointing to the file. A customized page is also listed in the content database, but the source of the page is also stored in the database. Future requests for that page (in the context of a specific site) will be served from the database, not from the file system.
Unghosted - Customized
In WSS v3 pages exist in one of two states: customized or uncustomized. An uncustomized page is one that is listed in the site's contents database, but the actual source of the page (the file) resides on the file system, and the content database simply contains a link pointing to the file. A customized page is also listed in the content database, but the source of the page is also stored in the database. Future requests for that page (in the context of a specific site) will be served from the database, not from the file system.
Saturday, January 10, 2009
SharePoint Development using C#
Before you start developing you need a reference to "using Microsoft.SharePoint;" namespace.
Working with a list
Short description of some classes:
Site Organization Classes
SPContext -
SPWebCollection -
SPListCollection -
SPWeb - represents site;
SPSite - represents site collection;
SPList -
List Classes
SPField -
SPView -
SPListItem -
Getting the Current Website
SPWeb web = SPContext.Current.Web;
Site Collection Navigation
SPSite siteCollection = SPContext.Current.Site;
SPWeb rootWeb = siteCollection.RootWeb;
TreeNode rootNode = new TreeNode(rootWeb.Title);
treeSiteCollection.Nodes.Add(rootNode);
addSubWebsToTree(rootWeb, rootNode);
Create a list
SPWeb web = SPContext.Current.Web;
web.AllowUnsafeUpdates = true;
SPList list;
try
{
list = web.Lists["Student Assignments"];
}
catch(Exception ex)
{
System.Guid listID
= web.Lists.Add("Student Assignments", "", SPListTemplateType.Tasks);
list = web.Lists[listID];
}
Creating a column in a list
SPFieldCollection fields = list.Fields;
SPField gradeField;
if (fields.ContainsField("Grade"))
{
gradeField = fields["Grade"];
}
else
{
fields.Add("Grade", SPFieldType.Number, false);
}
Adding Field to default view of the list
SPView defaultView = list.DefaultView;
if (!defaultView.ViewFields.Exists("Grade"))
{
defaultView.ViewFields.Add("Grade");
defaultView.Update();
}
Creating a new list item
SPListItemCollection items = list.Items;
SPListItem newItem = items.Add();
newItem["Title"] = "Homework 1";
newItem["DueDate"] = System.DateTime.Now;
newItem["Grade"] = 5; newItem.Update();
Working with a list
Short description of some classes:
Site Organization Classes
SPContext -
SPWebCollection -
SPListCollection -
SPWeb - represents site;
SPSite - represents site collection;
SPList -
List Classes
SPField -
SPView -
SPListItem -
Getting the Current Website
SPWeb web = SPContext.Current.Web;
Site Collection Navigation
SPSite siteCollection = SPContext.Current.Site;
SPWeb rootWeb = siteCollection.RootWeb;
TreeNode rootNode = new TreeNode(rootWeb.Title);
treeSiteCollection.Nodes.Add(rootNode);
addSubWebsToTree(rootWeb, rootNode);
Create a list
SPWeb web = SPContext.Current.Web;
web.AllowUnsafeUpdates = true;
SPList list;
try
{
list = web.Lists["Student Assignments"];
}
catch(Exception ex)
{
System.Guid listID
= web.Lists.Add("Student Assignments", "", SPListTemplateType.Tasks);
list = web.Lists[listID];
}
Creating a column in a list
SPFieldCollection fields = list.Fields;
SPField gradeField;
if (fields.ContainsField("Grade"))
{
gradeField = fields["Grade"];
}
else
{
fields.Add("Grade", SPFieldType.Number, false);
}
Adding Field to default view of the list
SPView defaultView = list.DefaultView;
if (!defaultView.ViewFields.Exists("Grade"))
{
defaultView.ViewFields.Add("Grade");
defaultView.Update();
}
Creating a new list item
SPListItemCollection items = list.Items;
SPListItem newItem = items.Add();
newItem["Title"] = "Homework 1";
newItem["DueDate"] = System.DateTime.Now;
newItem["Grade"] = 5; newItem.Update();
Sunday, January 4, 2009
Single Sign On Administration
Single Sign On –allow users to authenticate once into SharePoint and then access other applications such as Siebel or SAP using mapped credentials from encrypted credentials database. Administrators and developers use supporting application interfaces to manage single sign on credentials
Application Definition – metadata (username, passwords, group) about an application that that will be accessible through single sign on.
Saturday, January 3, 2009
Solution Deployment
Solution is a cab file with a manifest file that contains:
Solution is very similar to a web part package in SharePoint 2003
- Feature definitions
- Site Definitions
- Resources –Assemblies (DLLs) that implement related functionality
Solution is very similar to a web part package in SharePoint 2003
The “Global” Template
SharePoint provisions “Global” template before any other template
The template includes:
– Base type list schema definitions
•Generic List
•Document Library
•Discussion Forum
•Issues List
•Survey List
- Gallery Lists
•Master Page Gallery
•Web Part Gallery – only at the root site
•List Template Gallery – only at the root site
•Site Template Gallery – only at the root site
•User Information List – only at the root site
- Features
•Content Types
•Site Columns (Fields)
•Mobile Redirect
The template includes:
– Base type list schema definitions
•Generic List
•Document Library
•Discussion Forum
•Issues List
•Survey List
- Gallery Lists
•Master Page Gallery
•Web Part Gallery – only at the root site
•List Template Gallery – only at the root site
•Site Template Gallery – only at the root site
•User Information List – only at the root site
- Features
•Content Types
•Site Columns (Fields)
•Mobile Redirect
Site Definitions in 2007: Folder Structure
Program files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\
•GLOBAL – contains “Global Template” site definition
•SiteTemplates
- STS
- default.aspx
- XML
- onet.xml – references features
- does not contain base types
- does not contain list templates
- MPS
•FEATURES – contains all SharePoint and custom features
- CustomList
- Navigation
- DocumentLibrary – document library feature
- ListTemplates
- DocLib.xml
- DocLib
- Schema.xml – DOES NOT CONTAIN
- Upload.aspx
- No allitems.aspx or editform.aspx
•GLOBAL – contains “Global Template” site definition
•SiteTemplates
- STS
- default.aspx
- XML
- onet.xml – references features
- does not contain base types
- does not contain list templates
- MPS
•FEATURES – contains all SharePoint and custom features
- CustomList
- Navigation
- DocumentLibrary – document library feature
- ListTemplates
- DocLib.xml
- DocLib
- Schema.xml – DOES NOT CONTAIN
- Upload.aspx
- No allitems.aspx or editform.aspx
Subscribe to:
Posts (Atom)