SPSiteDataQuery Class
Imagine a scenario in which you want to run a single query against every list in the current site collection that has been created from the Announcements list type and return all list items that were created today. The following code sample demonstrates how to do this by creating an SPSiteDataQuery object, initializing it with the necessary CAML statements, and then passing it to the current SPWeb object’s GetSiteData method.
SPSiteDataQuery query = new SPSiteDataQuery();
query.Lists = @"";
query.ViewFields = @"";
query.Webs = "";
string queryText = @" ";
query.Query = queryText;
DataTable table = site.GetSiteData(query);
foreach (DataRow row in table.Rows) {
Console.WriteLine(row["Title"].ToString());
}
Using SPQuery to query specific items in the list
To get back specific results within a list, you can use the SPQuery object. When you use an SPQuery object, you will create CAML statements to select specific data within the target list. To select announcements that have expired, you may want to use a query built with CAML statements, as shown in the following example:
SPQuery query = new SPQuery();
query.ViewFields = @"";
query.Query =
@"
";
SPList list = site.Lists["Litware News"];
SPListItemCollection items = list.GetItems(query);
foreach (SPListItem expiredItem in items) {
Console.WriteLine(expiredItem["Title"]);
}
You must specify the fields you want returned in the query by using the ViewFields property. Also note that you must specify the fields in terms of the field Name, and not DisplayName. If you attempt to access fields without specifying them in ViewFields, you will experience an exception of type ArgumentException
Enumerating thought the Fields excluding Hidden and read only fields
foreach (SPListItem item in list.Items) {
foreach (SPField field in list.Fields) {
if (!field.Hidden && !field.ReadOnlyField)
Console.WriteLine("{0} = {1}", field.Title, item[field.Id]);
}
}
foreach (SPListItem item in list.Items) {
foreach (SPField field in list.Fields) {
if (!field.Hidden && !field.ReadOnlyField)
Console.WriteLine("{0} = {1}", field.Title, item[field.Id]);
}
}
Checking if the List Exists and Adding a new list if it does not Exists
using System;
using Microsoft.SharePoint;
class Program {
static void Main() {
using (SPSite site = new SPSite("http://localhost")) {
using (SPWeb web = site.OpenWeb()) {
string listName = "Litware News";
SPList list = null;
foreach (SPList currentList in web.Lists) {
if (currentList.Title.Equals(listName,
StringComparison.InvariantCultureIgnoreCase)) {
list = currentList;
break;
}
}
if (list == null) {
Guid listID = web.Lists.Add(listName,
"List for big news items",
SPListTemplateType.Announcements);
list = web.Lists[listID];
list.OnQuickLaunch = true;
list.Update();
}
}
}
}
}
Check if list is of the type Document Library or Not
public bool CkechIfListisDocLib(SPList list) {
if (list is SPDocumentLibrary)
return true;
else
return false;
}
Running a Code with Elevated Permissions
Use this in ur code. if u want to run a portion of the code with elevated permissions
SPSecurity.RunWithElevatedPrivileges(delegate()
{
// do something
});
Download a file from Document Library and Save it locally
private static void DownloadAFile()
{
SPSite site = new SPSite("http://wwdevserver:3000/"); //site url
SPWeb web = site.OpenWeb(@"/Admin"); //web url
SPList list = web.Lists["PDF Form Templates"]; //list name
File.WriteAllBytes(@"c:\m.pdf", list.Items[0].File.OpenBinary()); //downloading first items file
}
SPWebConfigModification Class - Editing Sharepoint Web.Config
I have seen some of the code where in if a "SafeControl" entry is need to be done in the web.config, through code, then we use
"XMLDocument" class to load the web.config and make changes . there is trouble in doing so as you need to manually get the path of the web.config and all.
But Sharepoint object model provides a class called "SPWebConfigModification" which can be used to play around with the web.config of the site.
Sample Code where in --Safe Control Entry is Made for the Webparts in the feature activation
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPSite site = (SPSite)properties.Feature.Parent;
if (site != null)
{
SPWebApplication webApp = site.WebApplication;
SPWebConfigModification ModDesc = new SPWebConfigModification();
ModDesc.Path = "configuration/SharePoint/SafeControls";
ModDesc.Name = "SafeControl[@Assembly='Description'][@Namespace='Description'][@TypeName='*'][@Safe='True'] [@AllowRemoteDesigner='True']";
ModDesc.Sequence = 0;
ModDesc.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
ModDesc.Value = "";
webApp.WebConfigModifications.Add(ModDesc);
webApp.Farm.Services.GetValue().ApplyWebConfigModifications();
webApp.Update();
}
Showing posts with label sharepoint Objectmodel. Show all posts
Showing posts with label sharepoint Objectmodel. Show all posts
Thursday, March 26, 2009
Monday, January 26, 2009
Sharepoint Installation Guide
Hi Sharepoint Installation power point presentation, which helps you easily
when installation, go through this .
Click Here
For this you have to download VirtualPC or VM , Avaliable at Microsoft site, it's free of cost
when installation, go through this .
Click Here
For this you have to download VirtualPC or VM , Avaliable at Microsoft site, it's free of cost
Tuesday, June 10, 2008
Introduction To Sharepoint
Introduction To Sharepoint Products and Technologies
WHAT IS SHAREPOINT ?
SharePoint is an extensible and scalable portal-based collaboration and document management platform from Microsoft
consisting of tools and technologies that collectively form what is known as SharePoint Products and Technologies. SharePoint
web sites and pages are commonly used to build intranet and extranet portals and team sites, as well as public-facing Internet
sites. SharePoint is a great platform upon which you can build business applications to help you better store, share, and manage
digital information within your organization. Because you can build with or without the need for code, SharePoint empowers the
average business user to create, deploy, and manage team web sites, without depending on skilled resources, such as systems
administrators or developers.
HISTORY OF SHAREPOINT
Around 2000, Microsoft unveiled an application called a Digital Dashboard. This web-based application used a new concept called web parts, which are rectangular areas on a web page that display some type of information, such as a list of contacts, links,or documents. This was innovative because the user could now arrange the web parts on the web page herself, without any help from an HTML programmer.
In 2001, Microsoft released its first two SharePoint products. One was SharePoint Team Services (STS), and the other was SharePoint Portal Server (SPS). STS was a free web-based product used for collaboration. You could use it to share contacts,calendar events, and documents within teams and small departments. The information was stored in an MS SQL database. It wasa nice application, but it did not have any document-management features, and it was not built for creating intranet solutions for larger organizations. SPS was a separate product using a built-in MS Exchange 2000 server database. This new SPS had built-in
document-management features, such as document versioning, check-out/check-in, and document workflow. It also had a good search engine that allowed the user to find information, regardless of where it was stored. One serious problem with SPS was the
quality of its performance and the limited number of documents it could manage. And it did not have some of the nice collaboration features that STS had. Also, SPS was not free like STS, but licensed per server and per user.
In October 2003, Microsoft released its second generation of SharePoint. The old STS, now renamed Windows SharePoint
Services (WSS), was basically a fancier version of STS (internally, Microsoft referred to it as STS version 2). SPS kept its name,
SharePoint Portal Server, but that was about all that was kept from the previous SPS version. No longer did SPS have its own MS Exchange database, and no longer was SPS a separate product! Now it was an add-on to the WSS application. Finally, Microsoft
had one integrated SharePoint solution, completely based on the MS SQL Server database.
Still, there were some annoying things about the SharePoint 2003 editions. Although they now looked very similar, they did not behave in a similar way. For example, the permission settings for lists in WSS was different from the same type of lists in SPS,
and while SPS was security-trimmed (users only saw what they were allowed to see), WSS was not.
At the end of 2006, Microsoft released the third generation of SharePoint. WSS kept its name, and the version number changed to WSS 3.0. WSS still was a free add-on for Windows 2003 Server and used an MS SQL–based server to store its content.
Its bigger brother SPS was now renamed MS Office SharePoint Server 2007 (MOSS), but it was still an optional add-on to WSS and was using the same MS SQL database as WSS. The MOSS server was available in different editions and with optional services,
such as MOSS 2007 Standard and MOSS 2007 Enterprise, plus Office Forms Server and Office SharePoint Server 2007 for Search.
MICROSOFT SHAREPOINT PRODUCTS AND TECHNOLOGIES
Microsoft’s SharePoint Products and Technologies suite primarily consists of
Microsoft Windows SharePoint Services 3.0(WSS 3.0), and
Microsoft Office SharePoint Server 2007 (MOSS).
Windows SharePoint Services 3.0 (WSS 3.0)
Windows SharePoint Services is a component of Microsoft Windows Server 2003. It is provided as a free download and gives
you a powerful toolset for organizing information, managing documents, increasing the efficiency of business processes, and
providing robust collaboration environments.
Windows SharePoint Services helps teams stay connected and productive by providing an infrastructure that allows easy
access to the people, documents, and information they need. With Windows SharePoint Services, teams can create Web sites to
share information and foster collaboration with other users. You can access content stored within a SharePoint site from a Web
browser and through desktop applications, such as Microsoft Office.
SharePoint sites provide places to capture and share ideas, information, communication, and documents. The sites facilitate
team participation in discussions, shared document collaboration, blogging, building knowledge bases using wikis, and surveys.
A SharePoint site can have many subsites, the hierarchy of which, on Web servers, resembles the hierarchy of folders on file
systems -- it is a tree-like structure.
The key components of SharePoint sites are lists and libraries.
* A SharePoint list contains rows and columns of data, much like a standard database table. SharePoint lists, however, are
much easier to create and maintain. They are great for collecting and sharing fielded information such as contact lists,
calendars of events, or custom information of any kind.
* A SharePoint library is similar to a list, except that it exists solely to store a collection of documents. Each list item
describes one document, providing information such as the file name, the file title, the date last modified, and the person who last modified the document. SharePoint libraries can retain multiple versions of each document, and they support
change control through document check-in and check-out. Windows SharePoint Services supports special library types
for pictures and for InfoPath forms.
Organizing these lists and libraries into team sites places most administration and content management in the hands of team
members who are close to the work and familiar with the subject matter. This avoids the bureaucracy and the waiting times that are
typical of strictly centralized administration. But at the same time, Microsoft provides all the tools that centralized administrators
need to keep the installation under control and running smoothly. Team members can access SharePoint Web sites using eithera browser or an Office 2007 application. Individuals in teams can configure lists and libraries to record whatever information theywant, and they can easily create shared work areas for documents, projects, and other work in progress. Members can sign up toreceive change notifications by e-mail.
You can also use Windows SharePoint Services as a development platform for creating custom collaboration and informationsharing applications. For example, third-party or in-house programmers can access SharePoint sites using Web services or readilyaccessible application programming interfaces. In addition, you can develop custom Web pages using SharePoint Designer
2007, and custom objects using Visual Studio.
Microsoft Office SharePoint Server 2007 (MOSS)
Microsoft Office SharePoint Server 2007 is built on top of Windows SharePoint Services. It extends Windows SharePoint
Services by providing flexible organization and management tools for SharePoint sites and by making it possible for teams to
publish information to the entire organization. Because MOSS requires Windows SharePoint Services, all features of Windows
SharePoint Services are available in MOSS. However, Microsoft Office SharePoint Server 2007 provides significant additional
enterprise-level capabilities, as detailed in the following list.
* Collaboration: The collaboration components build on Windows SharePoint Services collaboration functionality to help
keep teams connected and productive by providing easy access to people, documents, and information.
* Portal: The portal components of MOSS include features for designing, deploying, and managing enterprise intranet
portals, corporate Internet-presence Web sites, and divisional portal sites.
* Enterprise Search: The search components provide a consistent search experience, relevance of search results, functions
to search for people and expertise, ability to index and search data in line-of-business applications, and extensibility.
* Enterprise Content Management: Windows SharePoint Services provides core document management functionality
including major and minor versioning, check-in/check-out document locking, rich descriptive metadata, workflow, content
type–based policies, auditing, and role-based permissions at the document library, folder, and individual document levels.
MOSS builds on these capabilities to deliver enhanced authoring, business document processing, Web content management
and publishing, records management, policy management, and support for multilingual publishing.
* Business Process and Forms: This component provides a platform for rapid creation and deployment of XML-based
electronic forms, centralizes form management and maintenance, and helps to extend business processes to customers,
partners, and suppliers.
* Business Intelligence (BI): The BI features of MOSS provide Web and programmatic access to published Excel
spreadsheets, programmatic reuse of critical line-of-business data, and development of Web-based BI dashboards.
While WSS is a free component, MOSS must be licensed separately. MOSS comes in several different versions that target different deployment scenarios and have different licensing requirements. Regardless of your scenario, however, every organization using MOSS must purchase the base MOSS server license. Along with the server license, you must also purchase the appropriate client access licenses (CAL) to meet your needs. For general use, MOSS comes in a Standard and an Enterprise edition. The Standard edition gives you access to the basic set of MOSS functionality, including content management, workflow, and collaboration. The Enterprise edition includes the functionality of the Standard edition but adds the BDC, Excel Services, Office
Forms Server, and more. Additional versions allow you to use MOSS solely for deploying Internet sites or separate features such
as the Microsoft Office SharePoint Server 2007 for Search editions, and Microsoft Office Forms Server editions. To decide whether you need Windows SharePoint Services by itself or an edition of Microsoft Office SharePoint Server 2007,
you need to assess how your requirements are met by the particular features and functionality of these products.
WHAT IS SHAREPOINT ?
SharePoint is an extensible and scalable portal-based collaboration and document management platform from Microsoft
consisting of tools and technologies that collectively form what is known as SharePoint Products and Technologies. SharePoint
web sites and pages are commonly used to build intranet and extranet portals and team sites, as well as public-facing Internet
sites. SharePoint is a great platform upon which you can build business applications to help you better store, share, and manage
digital information within your organization. Because you can build with or without the need for code, SharePoint empowers the
average business user to create, deploy, and manage team web sites, without depending on skilled resources, such as systems
administrators or developers.
HISTORY OF SHAREPOINT
Around 2000, Microsoft unveiled an application called a Digital Dashboard. This web-based application used a new concept called web parts, which are rectangular areas on a web page that display some type of information, such as a list of contacts, links,or documents. This was innovative because the user could now arrange the web parts on the web page herself, without any help from an HTML programmer.
In 2001, Microsoft released its first two SharePoint products. One was SharePoint Team Services (STS), and the other was SharePoint Portal Server (SPS). STS was a free web-based product used for collaboration. You could use it to share contacts,calendar events, and documents within teams and small departments. The information was stored in an MS SQL database. It wasa nice application, but it did not have any document-management features, and it was not built for creating intranet solutions for larger organizations. SPS was a separate product using a built-in MS Exchange 2000 server database. This new SPS had built-in
document-management features, such as document versioning, check-out/check-in, and document workflow. It also had a good search engine that allowed the user to find information, regardless of where it was stored. One serious problem with SPS was the
quality of its performance and the limited number of documents it could manage. And it did not have some of the nice collaboration features that STS had. Also, SPS was not free like STS, but licensed per server and per user.
In October 2003, Microsoft released its second generation of SharePoint. The old STS, now renamed Windows SharePoint
Services (WSS), was basically a fancier version of STS (internally, Microsoft referred to it as STS version 2). SPS kept its name,
SharePoint Portal Server, but that was about all that was kept from the previous SPS version. No longer did SPS have its own MS Exchange database, and no longer was SPS a separate product! Now it was an add-on to the WSS application. Finally, Microsoft
had one integrated SharePoint solution, completely based on the MS SQL Server database.
Still, there were some annoying things about the SharePoint 2003 editions. Although they now looked very similar, they did not behave in a similar way. For example, the permission settings for lists in WSS was different from the same type of lists in SPS,
and while SPS was security-trimmed (users only saw what they were allowed to see), WSS was not.
At the end of 2006, Microsoft released the third generation of SharePoint. WSS kept its name, and the version number changed to WSS 3.0. WSS still was a free add-on for Windows 2003 Server and used an MS SQL–based server to store its content.
Its bigger brother SPS was now renamed MS Office SharePoint Server 2007 (MOSS), but it was still an optional add-on to WSS and was using the same MS SQL database as WSS. The MOSS server was available in different editions and with optional services,
such as MOSS 2007 Standard and MOSS 2007 Enterprise, plus Office Forms Server and Office SharePoint Server 2007 for Search.
MICROSOFT SHAREPOINT PRODUCTS AND TECHNOLOGIES
Microsoft’s SharePoint Products and Technologies suite primarily consists of
Microsoft Windows SharePoint Services 3.0(WSS 3.0), and
Microsoft Office SharePoint Server 2007 (MOSS).
Windows SharePoint Services 3.0 (WSS 3.0)
Windows SharePoint Services is a component of Microsoft Windows Server 2003. It is provided as a free download and gives
you a powerful toolset for organizing information, managing documents, increasing the efficiency of business processes, and
providing robust collaboration environments.
Windows SharePoint Services helps teams stay connected and productive by providing an infrastructure that allows easy
access to the people, documents, and information they need. With Windows SharePoint Services, teams can create Web sites to
share information and foster collaboration with other users. You can access content stored within a SharePoint site from a Web
browser and through desktop applications, such as Microsoft Office.
SharePoint sites provide places to capture and share ideas, information, communication, and documents. The sites facilitate
team participation in discussions, shared document collaboration, blogging, building knowledge bases using wikis, and surveys.
A SharePoint site can have many subsites, the hierarchy of which, on Web servers, resembles the hierarchy of folders on file
systems -- it is a tree-like structure.
The key components of SharePoint sites are lists and libraries.
* A SharePoint list contains rows and columns of data, much like a standard database table. SharePoint lists, however, are
much easier to create and maintain. They are great for collecting and sharing fielded information such as contact lists,
calendars of events, or custom information of any kind.
* A SharePoint library is similar to a list, except that it exists solely to store a collection of documents. Each list item
describes one document, providing information such as the file name, the file title, the date last modified, and the person who last modified the document. SharePoint libraries can retain multiple versions of each document, and they support
change control through document check-in and check-out. Windows SharePoint Services supports special library types
for pictures and for InfoPath forms.
Organizing these lists and libraries into team sites places most administration and content management in the hands of team
members who are close to the work and familiar with the subject matter. This avoids the bureaucracy and the waiting times that are
typical of strictly centralized administration. But at the same time, Microsoft provides all the tools that centralized administrators
need to keep the installation under control and running smoothly. Team members can access SharePoint Web sites using eithera browser or an Office 2007 application. Individuals in teams can configure lists and libraries to record whatever information theywant, and they can easily create shared work areas for documents, projects, and other work in progress. Members can sign up toreceive change notifications by e-mail.
You can also use Windows SharePoint Services as a development platform for creating custom collaboration and informationsharing applications. For example, third-party or in-house programmers can access SharePoint sites using Web services or readilyaccessible application programming interfaces. In addition, you can develop custom Web pages using SharePoint Designer
2007, and custom objects using Visual Studio.
Microsoft Office SharePoint Server 2007 (MOSS)
Microsoft Office SharePoint Server 2007 is built on top of Windows SharePoint Services. It extends Windows SharePoint
Services by providing flexible organization and management tools for SharePoint sites and by making it possible for teams to
publish information to the entire organization. Because MOSS requires Windows SharePoint Services, all features of Windows
SharePoint Services are available in MOSS. However, Microsoft Office SharePoint Server 2007 provides significant additional
enterprise-level capabilities, as detailed in the following list.
* Collaboration: The collaboration components build on Windows SharePoint Services collaboration functionality to help
keep teams connected and productive by providing easy access to people, documents, and information.
* Portal: The portal components of MOSS include features for designing, deploying, and managing enterprise intranet
portals, corporate Internet-presence Web sites, and divisional portal sites.
* Enterprise Search: The search components provide a consistent search experience, relevance of search results, functions
to search for people and expertise, ability to index and search data in line-of-business applications, and extensibility.
* Enterprise Content Management: Windows SharePoint Services provides core document management functionality
including major and minor versioning, check-in/check-out document locking, rich descriptive metadata, workflow, content
type–based policies, auditing, and role-based permissions at the document library, folder, and individual document levels.
MOSS builds on these capabilities to deliver enhanced authoring, business document processing, Web content management
and publishing, records management, policy management, and support for multilingual publishing.
* Business Process and Forms: This component provides a platform for rapid creation and deployment of XML-based
electronic forms, centralizes form management and maintenance, and helps to extend business processes to customers,
partners, and suppliers.
* Business Intelligence (BI): The BI features of MOSS provide Web and programmatic access to published Excel
spreadsheets, programmatic reuse of critical line-of-business data, and development of Web-based BI dashboards.
While WSS is a free component, MOSS must be licensed separately. MOSS comes in several different versions that target different deployment scenarios and have different licensing requirements. Regardless of your scenario, however, every organization using MOSS must purchase the base MOSS server license. Along with the server license, you must also purchase the appropriate client access licenses (CAL) to meet your needs. For general use, MOSS comes in a Standard and an Enterprise edition. The Standard edition gives you access to the basic set of MOSS functionality, including content management, workflow, and collaboration. The Enterprise edition includes the functionality of the Standard edition but adds the BDC, Excel Services, Office
Forms Server, and more. Additional versions allow you to use MOSS solely for deploying Internet sites or separate features such
as the Microsoft Office SharePoint Server 2007 for Search editions, and Microsoft Office Forms Server editions. To decide whether you need Windows SharePoint Services by itself or an edition of Microsoft Office SharePoint Server 2007,
you need to assess how your requirements are met by the particular features and functionality of these products.
Monday, June 2, 2008
Share point Portal Introduction
SharePoint Portal Server Introduction:
SharePoint is a web-based collaboration and document management platform from Microsoft. Sharepoint portal is a site provisioning tool which we can automatically develops a site and can host millions of website. Share point sites are actually ASP.net2005 applications which can host under IIS webserver and SqlServer as a database to store the data at backend.
Share point can be used to host web sites that can be used to access shared workspaces and documents, as well as specialized applications such as teamsites,wikis, blogs and many other forms of applications.
MICROSOFT SHAREPOINT PRODUCTS AND TECHNOLOGIES
Microsoft’s SharePoint is a set of products and technologies primarily consists of
Microsoft Windows SharePoint Services 3.0(WSS 3.0),
Microsoft Office SharePoint Server 2007 (MOSS),
Microsft Share point search Server, and
Microsoft Sharepoint Designer view.
HISTORY OF SHAREPOINT
Around 2000, Microsoft unveiled an application called a Digital Dashboard. This web-based application used a new concept called web parts, which are rectangular areas on a web page that display some type of information, such as a list of contacts, links,
or documents. This was innovative because the user could now arrange the web parts on the web page herself, without any help from an HTML programmer.
In 2001, Microsoft released its first two SharePoint products. One was
SharePoint Team Services (STS), and the other was
SharePoint Portal Server (SPS).
In October 2003, Microsoft released its second generation of SharePoint. The old STS, now renamed Windows SharePoint Services (WSS2.0)
At the end of 2006, Microsoft released the third generation of SharePoint. WSS kept its name, and the version number changed to WSS 3.0.
WSS still was a free add-on for Windows 2003 Server and used an MS SQL–based server to store its content.
Its bigger brother Share point portal(SPS) was now renamed MS Office SharePoint Server 2007 (MOSS), but it was still an optional add-on to WSS and
was using the same MS SQL database as WSS. The MOSS server was available in different editions and with optional services,
such as MOSS 2007 Standard and MOSS 2007 Enterprise, plus Office Forms Server and Office SharePoint Server 2007 for Search.
Microsoft Windows SharePoint Services 3.0(WSS 3.0),
Windows SharePoint Services (WSS) is a free add-on to Windows Server. WSS offers the base collaborative infrastructure, supporting HTTP- and HTTPS-based editing of documents, as well as document organization in document libraries, version control capabilities, wikis, and blogs. It also includes end-user functionality such as workflows, to-do lists, alerts and discussion boards,[1] which are exposed as web parts to be embedded into SharePoint pages. WSS was previously known as SharePoint Team Services.
A SharePoint site can have many subsites, the hierarchy of which, on Web servers, resembles the hierarchy of folders on file systems -- it is a tree-like structure.
The key components of SharePoint sites are lists and libraries.
Microsoft Windows SharePoint Services 3.0(WSS 3.0),
Microsoft Office SharePoint Server (MOSS) is a costed component of the Microsoft Office server suite. MOSS is built on top of WSS and adds more functionality to it, including better document management, enterprise search functionality, navigation features, RSS support, as well as features from Microsoft Content Management Server. The MOSS2007 Cameup With a New Features like:
Subscribe to:
Posts
(
Atom
)