Posted by: Shantham | January 26, 2012

2011 in review


The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 36,000 times in 2011. If it were a concert at Sydney Opera House, it would take about 13 sold-out performances for that many people to see it.

Click here to see the complete report.

Advertisements
Posted by: Shantham | May 1, 2011

Microsoft Community Contributor Award – 2011


I was surprised on Thursday morning, when I saw my inbox, which has the Microsoft Community Contributor award mail from Microsoft. I am very pleased and share this with you all that my community contributions are recognized by Microsoft.

Microsoft Community Contributor Award 2011 - Shantha Kumar .T

This was a very special surprise for me. Thanks Microsoft.

MCC -2011 Logo

Posted by: Shantham | March 6, 2011

Updating SharePoint ListItems


There are two methods available to update the List Items on SPListItem Object.
SPListItem.Update();
SPListItem.SystemUpdate();

SPListItem.Update() used to update all the values in SharePoint List Item including pre-defined hidden fields. If we modified the item, that will affects the Modified Date, Modified By, Version information fields.

SPList olist = oweb.Lists.TryGetList(“ListName”);
SPListItem olistitem = olist.Items[1];
olistitem.Title = “Sample List Item”
olistitem.Update();
olist.Update();

SPListItem.SystemUpdate() method used to update the values of the listitem without modifying the Modified Date, Modified By and Version information fields.

SPList olist = oweb.Lists.TryGetList(“ListName”);
SPListItem olistitem = olist.Items[1];
olistitem.Title = “Sample List Item”
olistitem.SystemUpdate();
olist.Update();

Read More…

Posted by: Shantham | July 2, 2009

http://www.ktskumar.com


I am waiting for long time to own a new domain , and now it’s happened. Just visit my new blog here, http://www.ktskumar.com . And I want to share with you all the things I learned, mainly Sharepoint, Silverlight, JQuery, Bing , so always tune me on my new Url  to keep updated with my blog.

Posted by: Shantham | April 25, 2009

Creating sub-sites using WebService


I noticed in MSDN forums, many of them are struggling with creation of sub-sites using webservice in sharepoint.

I take a look on that, Because they are all try to use CreatSite method in Admin webservice. But that will help only on creating SiteCollections.

Then how we can create a susite? It’s very easy if you are look in to Meetings webservice. This will have a CreateWorkspace method.

URL for Meetings webservice: ~site/_vti_bin/meetings.asmx

Syntax :
CreateWorkspace([Site Title],[Site Template],[LCID],[TimeZone Information]);

Sample Code:
MeetingWebService.Meetings WMService = new MeetingWebService.Meetings(); MeetingWebService.TimeZoneInf tz = new MeetingWebService.TimeZoneInf(); XmlNode xnode= WMService.CreateWorkspace(“sitename”, “STS#0”, 1033, tz);

Read More….

🙂 Cheers guys

Posted by: Shantham | April 14, 2009

SharePoint Database SQL Query Tips4


Where are the Documents or files we uploaded or attached stored in sharepoint? Many of them know, those files are stored under SharePoint Content Database. But on which database table, on which format?

For that, i did a quick research on that, and here i give those results,

  • The AllDocStreams table in SharePoint Content Database stores the Document Contents.
  • The Contents of the document are stored in Content Column in the AllDocStream table.
  • The Content column is the Image Datatype, (stores in the format of Binary).

I provide a simple SQL Query to retrieve the Document List Name,File Name, URL, and the Content (Binary Format)

SELECT AllLists.tp_Title AS ‘List Name’,
AllDocs.LeafName AS ‘File Name’,
AllDocs.DirName AS ‘URL’,
AllDocStreams.Content AS ‘Document Contnt (Binary)’
FROM AllDocs
JOIN AllDocStreams
ON
AllDocs.Id=AllDocStreams.Id
JOIN AllLists
ON
AllLists.tp_id = AllDocs.ListId

By Sooner, I’ll come up with other interesting Sql Query Tips.

Read more…

Posted by: Shantham | April 11, 2009

Download all files from SharePoint Library


Now, we are going to see how we can download all documents(incluing sub folders) from SharePoint Library.

First of all,we have get all documents from SharePoint Library. The following code help us to get all the documents including Subfolders.
//Get the Document Library and its view
SPList list = web.Lists[“Test Document”];
SPView view = list.Views[“All Documents”];

//Query all documents in Library including files under subfolders
SPQuery squery = new SPQuery(view);
squery.ViewAttributes = “Scope=\”Recursive\””;
SPListItemCollection items = list.GetItems(squery);

Now we have to write a code for downloaing documents,
//Read all documents and write those files to Local System
foreach (SPListItem item in items)
{
byte[] binfile = item.File.OpenBinary();
FileStream fstream = new FileStream(“F:\\” + item.File.Name, FileMode.Create, FileAccess.ReadWrite);
fstream.Write(binfile, 0, binfile.Length);
fstream.Close();
}

By using the above code snippets, we can download all document from SharePoint Library.
Read more….

Posted by: Shantham | April 3, 2009

User Information List – URL


In my WSS – User Information List post, I’ll list out the fields available under hidden “User Information List”. Now i’ll like to share the details of URL for that “User Information List”.

By using follwoing code, we can get the Users list url,

SPList userList = SPContext.Current.Web.SiteUserInfoList;
string url = userList.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url;

the above code will return like the following url http://mysite/_layouts/userdisp.aspx. But, this url is not the exact url.

The actual url for “User Information List” available under _Catalogs folder.
FYI, I list out the url’s here,

In my next post, i’ll explain about the default folders available in this “User Information List”.

Read more….

Posted by: Shantham | March 23, 2009

SharePoint Database SQL Query Tips3


Now, we are going to retrive the file details from AllDocs Database. Which has the informations about the files stored in SharePoint List or Library.

— Returns all document from all lists availabe in WebApplication
SELECT AllDocs.Leafname AS FileName’
                 AllDOcs.Dirname AS ‘Folder Path’
                 AllLists.tp_Title AS ‘List Title’,
                 Webs.Title AS ‘Web Title’
FROM AllDocs
JOIN AllLists
ON
AllLists.tp_Id=AllDocs.ListId
JOIN Webs
ON
Webs.Id=AllLists.tp_WebId
ORDER BY
webs.title

If you need the file informations about particular document type. Use the Extension column to check the document type.

For Ex., The following Query returns only master pages on all WebSites,

— Returns master pages in WebApplication for all WebSites
SELECT AllDocs.Leafname AS FileName’
                 AllDocs.Dirname AS ‘Folder Path’
                 AllLists.tp_Title AS ‘List Title’,
                 Webs.Title AS ‘Web Title’
FROM AllDocs
JOIN AllLists
ON
AllLists.tp_Id=AllDocs.ListId
JOIN Webs
ON
Webs.Id=AllLists.tp_WebId
WHERE Extension=’master’
ORDER BY Webs.Title

Like the above query, we can get all type of documents.

Read more….

Posted by: Shantham | March 19, 2009

SharePoint Database SQL Query Tips2


Today, we are going to see the query for returning Webs and Site Collections available in the Database (WebApplication).

–Returns Total Number of Site Collections in WebApplication
select  count(*) as ‘Total Site Collection’ from sites

–Returns Root Site Title for each Site Collection available in WebApplication
 
select Title as ‘Root Web Title’, Sites.RootWebId, Sites.Id as ‘Site Collection ID’ from webs inner join Sites on Webs.Id = Sites.RootWebId

–Returns Total Web Sites in WebApplication
select count(*) from Webs

–Returns WebSite Title and Site Id
select Title as ‘Site title’,FullUrl, SiteId as ‘Site Collection Id’ from Webs order by SiteId

–Returns Total number of Web Sites under each SiteCollection
select SiteId, count(*) as ‘Total Sub Sites’ from Webs inner join Sites on Sites.Id = Webs.SiteId group by SiteId

Webs Database stores the informations on Web Sites.
Sites Database stores the informations on Site Collections.

Read more….

Older Posts »

Categories