Archive for September, 2007

U2U CAML Builder sharepoint feature

Karine Bosch has released her new version of U2U CAML Builder which is now a sharepoint feature instead of widnows application.
find more about this really useful feature in
Karine’s post
.
 
Click here to download.
 
Thanx Karine for such a wonderful tool  
Advertisements

Comments (2)

Creating web parts Visual studio 2005 extensions for WSS.

 
With Visual Studio 2005 Extensions for WSS its very easy to create a web part. Today I wanted to demonstrate how we can easily create a simple web part using Visual Studio 2005 Extensions for WSS .
 
 How to create a web part with Visual studio 2005 extensions for WSS. 
 
    Click here to download the document
 
 

Comments (2)

SPSiteDataQuery Samples for WSS v3

Nice Article I found on the Internet.
 
I have been playing with the SPSiteDataQuery a fair bit recently and thought it would be interesting to post some of the results.

When using the SPSiteDataQuery to perform a search there are four main properties you are going to set which determine the results you will get. If you have seen my previous post (XML results using SPSiteDataQuery in SharePoint) you will have seen that they are Lists, Query, Webs and ViewFields.

If you read nothing else then remember this…If you make a mistake in the Webs or Lists properties, invalid XML or invalid attributes, the SPSiteDataQuery will fall back to it’s default behavior and will not throw an error!! Knowing this can save a lot of time…ensure your properties are correctly formatted.

So, assuming the basic setup is

SPSiteDataQuery q = new SPSiteDataQuery();
q.Lists = "<Lists BaseType='1'/>";
q.Query = "<Where><Gt><FieldRef Name='ID' /><Value Type='Number'>0</Value></Gt></Where>";
q.Webs = "<Webs Scope='SiteCollection' />";
q.ViewFields = "<FieldRef Name='Title' /><FieldRef Name='ID' />"';
q.RowLimit = 10;

Here are the changes you can make to achieve different result sets and tips as to why the query could be failing.

 

The Webs Property

There are basically three different values for this…

"<Webs Scope=’SiteCollection’ />" This will search the entire site collection no matter which web you use to execute the query.
"<Webs Scope=’Recursive’ />" This will search the web on which you execute the query and recurse through any child webs.

"" If you leave it blank then it will only search the web on which you execute the query. No child webs will be queried. This is important as I have read on several other sites that this is not possible with SPSiteDataQuery, but it is!!

I would also point out that that if you get anything wrong with this property SharePoint will not throw an error, it will just default to the blank behavior…It will only search the web on which you executed the query. This is an important point as "<Webs scope=’Recursive’ />"  or "<Webs Scope=’recursive’ />" (small ‘s’ in Scope and small ‘r’ in recursive) look OK but are actually invalid and the query will default to only the current web.

 

The Lists Property

This defines what type of document libraries and lists WSS will search for your items. You can specify the exact type of list, the base type or even specific lists. Examples of the Lists property are…

"<Lists BaseType=’1’/>" As above, this will search all lists which are based on a ‘Document Library. This is useful if you only want to find documents. Other values for BaseType include…

0 – Generic list – This will search all lists and not document libraries.
1 – Document Library
3 – Discussion Forum
4 – Vote or Survey
5 – Issues list

(no, I don’t know what happened to number 2!!)

I should also point out that the default is to search BaseType = ‘0’ , and so if you do not set or make a mistake in the XML only lists will be searched.

"<Lists ServerTemplate=’850’/>" This will limit the search to only a particular list template (850 is the Pages template in a publishing site). The number is fairly random and is defined in the list definition. I haven’t needed to look at them as yet so I don’t know a better way than looking in the definitions in the FEATURES folder for SharePoint. If you make a mistake with this property it will revert to the default.

Another options is Hidden, which determines if hidden lists or document libraries are searched. This an additional attribute and would be used like this…

"<Lists ServerTemplate=’850′ Hidden=’TRUE’/>"

The MaxListLimit attribute specifies the total number of lists to search. You will receive an exception if the query exceeds the MaxListLimit. The default amount is 1000 and by setting this to 0 you can search everything. So the following would only search the first 50 lists…

"<Lists BaseType=’1′ MaxListsLimit=’50’/>"

Another thing you can do with the Lists property is to query specific lists. This can be done by specifying the Guid of the list you want to search. An example would be…

"<Lists><List ID="129AB4CAE-12EF-9871-DE45-F34A180D3EAB5"/></Lists>"

You would obviously need to know the Guid of the lists you wish to query before creating this property.

 

The ViewFields property

The ViewFields property specifies the fields (columns), that will be returned in the query. This is very similar to SQL and you should ensure that you specify any fields that you may wish to use in you Where or OrderBy part of the query.

Things to point out here is that that you can specify the ID(Guid) of the property or the name of the property…this is the Internal Name, not the name you may see in the UI. For example the standard publishing field "Image Caption" would become "PublishingImageCaption" as that is it’s internal name.

So, to add the "Image Caption" filed to the results we would need…

"<FieldRef Name=’Title’ /><FieldRef Name=’ID’ /><FieldRef Name=’PublishingImageCaption’ />"

Another thing to remember is that not all lists or documents libraries contain the same fields. If you are not worried about a particular field and want the item returned whether the field (column) exists or not the you can set Nullable to true. So if we have some items which may not have an ‘Image Caption’ column then we could use…

"<FieldRef Name=’Title’ /><FieldRef Name=’ID’ /><FieldRef Name=’PublishingImageCaption’ Nullable=’TRUE’/>"

and this would still find those items without an ‘Image Caption’ column (field).

 

The Query Property

This property will allow you to bot limit and order you results. You can do both or just one, but it is similar to SQL in what you can do. There is a lot to this, but I will give a couple of samples…

Querying by date…

string sLastWeek = SPUtility.CreateISO8601DateTimeFromSystemDateTime(DateTime.Today.AddDays(-1));
q.Query = "<Where><Gt><FieldRef Name=’Created’><Value Type=’DateTime’>" + sLastWeek + "</Value></Gt></Where>";

This will find items created within the last week. The <Gt> denotes ‘Greater Than’, you could also use <Gte>, <Lt> or <Eq>. These can be combined to create more complex queries.

q.Query = "<OrderBy><FieldRef Name=’Title’ Ascending=’FALSE’></OrderBy>";

This will order the items descending by the title (Z-A).

q.Query = "<Where><Gt><FieldRef Name=’Created’><Value Type=’DateTime’>" + sLastWeek + "</Value></Gt></Where><OrderBy><FieldRef Name=’Title’ Ascending=’FALSE’></OrderBy>";

This is a combination of the above…items created in the last week ordered Z-A.

Finally, make sure you set the RowLimit property…you may not get any results otherwise!!

More information can be found on MSDN.
 

Comments (1)

SharePoint Solution Generator::Creating a site definiton from an existing site

Ok to get started I have created a new team site, based on the standard team site template. I have created two Custom Lists in the site named Employees and Employee Education respectively both with some added columns like Employee Name, Employee Address, Phone, Degree, College , Grade etc.
 
Now lets start SharePoint Solution Generator and start creating a site definition solution.
 
 
1) Run SharePoint Solution Generator.
 
 
2) Click on Site Definition and Click Next.
 

 
3) Now choose a site instance you would like to create a site definition template from, or else you can specify a URL also . Once done please click Next.
 

>

4) Specify the location to Save your site definition and also specify the project name.;

5) Finally press finish to proceed with generating the solution.

 6) Click on "Click here to open the generated solution".

 7) The result is a C# site definition solution with the following elements in it:

8) Start debbuging the solution. The following is the output.

—— Build started: Project: Oz Site Definiton, Configuration: Debug Any CPU ——

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.SharePoint.dll" /reference:"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.SharePoint.Security.dll" /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.XML.dll /debug+ /debug:full /keyfile:Properties\Temporary.snk /optimize- /out:obj\Debug\Oz_Site_Definiton.dll /target:library Properties\AssemblyInfo.cs "Site Provisioning Handler\SiteProvisioning.cs" "Site Provisioning Handler\SiteProvisioning.Internal.cs"

Compile complete — 0 errors, 0 warnings

Oz Site Definiton -> C:\Documents and Settings\uzubair\My Documents\SharePoint Definitions\Oz Site Definiton\bin\Debug\Oz_Site_Definiton.dll

—— Deploy started: Project: Oz Site Definiton, Configuration: Debug Any CPU ——

—— Generate Oz_Site_Definiton.wsp file and setup batch file——

Creating solution …

Operation completed successfully.

Creating setup batch file …

Operation completed successfully.

—— Add and deploy Oz_Site_Definiton.wsp to the SharePoint ——

Adding solution …

Operation completed successfully.

Deploying solution …

Operation completed successfully.

—— Activate features in solution if necessary ——

No features in this solution were activated

Restarting IIS …

Operation completed successfully.

========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========

========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========

9) We can now create an instance of our new site definition. If we go to the create site screen there appeared an extra template selection tab called "Development" where our new site definition appears:

 

10) Select your definition as a site template and create site and it all works !!

 
 

Comments (9)

How to include items from folders within your CAML query Results

 

By default, only items out of the root folder are returned but there is a property you can set to get the results out of a folder (or all of them if you write a small loop).

SPSite site = new SPSite("http://usmanz");
if (site != null)
{
   SPWeb web = site.OpenWeb();
   foreach (SPList docLib in web.Lists)
   {
     if (docLib.Title == "Shared Documents")
     {
     foreach (SPFolder subFolder in  docLib.RootFolder.SubFolders)
     {
        SPQuery query = new SPQuery();
        query.Query = "<OrderBy><FieldRef Name=’Title’/></OrderBy>";
       query.Folder = subFolder;
        System.Data.DataTable table = docLib.GetItems(query).GetDataTable();
     }
   }
 }
}

 

Leave a Comment

Guidelines using SharePoint 2007

I found these guidelines in Blogs, articles on the internet but I wanted to group them together. 
 

 

Limit 

# site collections in a web application 

50.000 

# sites in a site collection

250.000 

# subsites nested in a site 

2000 

# lists 

2000 

# items in a list 

10.000.000 

# documents in library 

2.000.000

# documents in folder

2000

# documents in index

50.000.000

Maximum document file size

2 GB

# search scopes

1000

# user profiles

5.000

 

These guidelines are not hard limits, meaning if you have 2005 lists on a site, your site will still work. The only thing that could happen by adding more items is that your performance could decrease.

 

Leave a Comment

STSADM.EXE Tool Complete list of administrative operations

The Stsadm.exe tool allows you to perform various administration tasks at the command line prompt. You can also use the command line to execute various scripts such as creating a backup schedule. Stsadm.exe includes administrative operations not found under the Central Administration site.
 

Usage:
           stsadm.exe -o <operation> [<parameters>]
           stsadm.exe -help [<operation>]

Operations:
              
activatefeature
           addalternatedomain
           addcontentdb
           adddataconnectionfile
           addexemptuseragent
           addpath
           addpermissionpolicy
           addsolution
           addtemplate
           adduser
           addwppack
           addzoneurl
           allowuserformwebserviceproxy
           allowwebserviceproxy
           associatewebapp
           authentication
           backup
           backuphistory
           binddrservice
           blockedfilelist
           canceldeployment
           changepermissionpolicy
           copyappbincontent
           createadminvs
           createcmsmigrationprofile
           creategroup
           createsite
           createsiteinnewdb
           createssp
           createweb
           databaserepair
           deactivatefeature
           deleteadminvs
           deletealternatedomain
           deletecmsmigrationprofile
           deleteconfigdb
           deletecontentdb
           deletegroup
           deletepath
           deletepermissionpolicy
           deletesite
           deletesolution
           deletessp
           deletessptimerjob
           deletetemplate
           deleteuser
           deleteweb
           deletewppack
           deletezoneurl
           deploysolution
           deploywppack
           disablessc
           displaysolution
           editcmsmigrationprofile
           editcontentdeploymentpath
           editssp
           email
           enablecmsurlredirect
           enablessc
           enumalternatedomains
           enumcontentdbs
           enumdataconnectionfiledependants
           enumdataconnectionfiles
           enumdeployments
           enumexemptuseragents
           enumformtemplates
           enumgroups
           enumroles
           enumservices
           enumsites
           enumsolutions
           enumssp
           enumssptimerjobs
           enumsubwebs
           enumtemplates
           enumusers
           enumwppacks
           enumzoneurls
           execadmsvcjobs
           export
           extendvs
           extendvsinwebfarm
           formtemplatequiescestatus
           getadminport
           getdataconnectionfileproperty
           getformtemplateproperty
           getproperty
           getsitedirectoryscanschedule
           getsitelock
           geturlzone
           import
           installfeature
           managepermissionpolicylevel
           migrateuser
           moveossindex
           movepropagationlocation
           osearch
           preparetomove
           profilechangelog
           provisionservice
           quiescefarm
           quiescefarmstatus
           quiesceformtemplate
           reconvertallformtemplates
           registerwsswriter
           removedataconnectionfile
           removedrservice
           removeexemptuseragent
           renameserver
           renameweb
           restore
           restoressp
           retractsolution
           retractwppack
           runcmsmigrationprofile
           runcontentdeploymentjob
           scanforfeatures
           searchdiacriticsensitive
           setadminport
           setapppassword
           setconfigdb
           setcontentdeploymentjobschedule
           setdataconnectionfileproperty
           setdefaultssp
           setformtemplateproperty
           setholdschedule
           setpolicyschedule
           setproperty
           setrecordsrepositoryschedule
           setsearchandprocessschedule
           setsearchserver
           setsharedwebserviceauthn
           setsitedirectoryscanschedule
           setsitelock
           setsspport
           setworkflowconfig
           siteowner
           spsearch
           sync
           syncsolution
           unextendvs
           uninstallfeature
           unquiescefarm
           unquiesceformtemplate
           unregisterwsswriter
           updateaccountpassword
           updatealerttemplates
           updatefarmcredentials
           upgradesolution
           userrole
           verifyformtemplate

Examples:
stsadm.exe -o addpath -url http://server/sites -type wildcardinclusion
stsadm.exe -o adduser
           -url http://server/site
           -userlogin DOMAIN\name
           -useremail someone@example.com
           -role reader
           -username "Your Name"
           -siteadmin
stsadm.exe -o backup -url http://server/site -filename backup.dat -overwrite
stsadm.exe -o backup -directory c:\backup -backupmethod full
stsadm.exe -o createadminvs
           -admapcreatenew
           -admapidname StsAdminVs
           -admapidtype configurableid
           -admapidlogin DOMAIN\user
           -admapidpwd Password
stsadm.exe -o createsite -url http://server/site
           -ownerlogin DOMAIN\name
           -owneremail someone@example.com
stsadm.exe -o createweb -url http://server/site/web
stsadm.exe -o deletesite -url http://server/site
stsadm.exe -o deleteweb -url http://server/site/web
stsadm.exe -o enumsites -url http://server
stsadm.exe -o enumsubwebs -url http://server/site/web
stsadm.exe -o enumusers -url http://server/site/web
stsadm.exe -o extendvs -url http://server:80
           -ownerlogin DOMAIN\name
           -owneremail someone@example.com
stsadm.exe -o renameweb -url http://server/site/web1 -newname web2
stsadm.exe -o restore -url http://server/site -filename backup.dat
stsadm.exe -o restore -directory c:\backup -restoremethod overwrite
stsadm.exe -o setconfigdb -databaseserver server
stsadm.exe -o unextendvs -url http://server

For information about other operations and parameters,
use "stsadm.exe -help" or "stsadm.exe -help <operation>"

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN>stsa
dm -help getproperty

stsadm.exe -o getproperty
           -propertyname <property name>
           [-url <url>]

SharePoint cluster properties:
        avallowdownload
        avcleaningenabled
        avdownloadscanenabled
        avnumberofthreads
        avtimeout
        avuploadscanenabled
        database-connection-timeout
        data-retrieval-services-enabled
        data-retrieval-services-oledb-providers
        data-retrieval-services-response-size
        data-retrieval-services-timeout
        data-retrieval-services-update
        dead-site-auto-delete
        dead-site-notify-after
        dead-site-num-notifications
        defaultcontentdb-password
        defaultcontentdb-server
        defaultcontentdb-user
        delete-web-send-email
        irmaddinsenabled
        irmrmscertserver
        irmrmsenabled
        irmrmsusead
        job-dead-site-delete
        job-sqm-timer
        job-usage-analysis
        job-watson-trigger
        large-file-chunk-size
        token-timeout

SharePoint virtual server properties:
        alerts-enabled
        alerts-limited
        alerts-maximum
        change-log-expiration-enabled
        change-log-retention-period
        data-retrieval-services-enabled
        data-retrieval-services-inherit
        data-retrieval-services-oledb-providers
        data-retrieval-services-response-size
        data-retrieval-services-timeout
        data-retrieval-services-update
        days-to-show-new-icon
        dead-site-auto-delete
        dead-site-notify-after
        dead-site-num-notifications
        defaultquotatemplate
        defaulttimezone
        delete-web-send-email
        job-change-log-expiration
        job-dead-site-delete
        job-diskquota-warning
        job-immediate-alerts
        job-recycle-bin-cleanup
        job-usage-analysis
        job-workflow
        max-file-post-size
        peoplepicker-onlysearchwithinsitecollection
        peoplepicker-searchadcustomquery
        peoplepicker-searchadforests
        presenceenabled
        recycle-bin-cleanup-enabled
        recycle-bin-enabled
        recycle-bin-retention-period
        second-stage-recycle-bin-quota
        send-ad-email

 

NOTE: To use stsadm.exe you must be a member of the administrator group.

 

Comments (11)

« Newer Posts · Older Posts »