<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5071529446265333712</id><updated>2011-11-27T15:14:31.827-08:00</updated><category term='sitecollection and site'/><category term='Joined Subview'/><category term='breadcrumbs'/><category term='delete layout from master page gallery'/><category term='Sharepoint-Exchange'/><category term='SetAvailablePageLayouts() method'/><category term='OWA on MOSS'/><category term='create instance'/><category term='SPList'/><category term='OWA-Sharepoint integration'/><category term='add layout in available layout gallery'/><category term='SPSiteDataQuery Class'/><category term='wepart'/><category term='replace webpart'/><category term='Accessing SPList'/><category term='MySite Customization'/><category term='cross web application'/><category term='Developing Custom webpart'/><category term='custom breadcrumbs in sharepoint 2007'/><category term='Caching SPList'/><title type='text'>Talk Sharepoint Only</title><subtitle type='html'>All the blogs under 'Talk sharepoint only' are related to sharepoint development and customization.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://deewaker-blogs.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://deewaker-blogs.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Deewaker</name><uri>http://www.blogger.com/profile/15690030536538037902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_YDWh2EZyP0s/TU0maCfC-QI/AAAAAAAAAEU/qxtDZsNq9qs/s220/08122010.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5071529446265333712.post-5360197135864778722</id><published>2011-04-24T23:41:00.000-07:00</published><updated>2011-04-25T00:13:21.356-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='delete layout from master page gallery'/><title type='text'>Deleting layout from layout gallery</title><content type='html'>When we want to delete a particular layout from layout gallery and it is being referred by pages (pages created by this layout), we will not be able to delete the layout. It will redirect us to error page stating-"&lt;strong&gt;This item cannot be deleted because it is still referenced by other pages&lt;/strong&gt;." So, to remove the layout, we will have to remove all the pages which are referring the layout and then we will be able to remove the layout. Alternatively, we can move the layout to a temporary folder by opening the master page gallery in window explorer and then remove the temporary folder. Moving a layout to a different folder will break all the page references and therefore removing the layout will not create any problem.&lt;br /&gt;This we can also do through code as below-&lt;br /&gt;&lt;br /&gt;private static void DeleteLayoutFromGallery(SPWeb web, string layoutName)&lt;br /&gt;        {&lt;br /&gt;            SPFile layout = web.GetFile(web.Site.Url.ToString() + "/_catalogs/masterpage/" + layoutName);&lt;br /&gt;            SPFolder layoutFolder = layout.ParentFolder;&lt;br /&gt;            SPFolder tempFolder = layoutFolder.SubFolders.Add("tempFolder");&lt;br /&gt;            layout.MoveTo(tempFolder.Url + "/" + layout.Name);&lt;br /&gt;            tempFolder.Delete();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;The important point to note is- All the pages refering the deleted layout will not get the layout reference and hence will get corrupted. Even if we re-add those layouts through feature, broken references will still be broken and pages will remain be corrupted. If we will try to open those pages, It will display error message reading- "&lt;strong&gt;Resource can not be found&lt;/strong&gt;."&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5071529446265333712-5360197135864778722?l=deewaker-blogs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deewaker-blogs.blogspot.com/feeds/5360197135864778722/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://deewaker-blogs.blogspot.com/2011/04/deleting-layout-from-layout-gallery.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/5360197135864778722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/5360197135864778722'/><link rel='alternate' type='text/html' href='http://deewaker-blogs.blogspot.com/2011/04/deleting-layout-from-layout-gallery.html' title='Deleting layout from layout gallery'/><author><name>Deewaker</name><uri>http://www.blogger.com/profile/15690030536538037902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_YDWh2EZyP0s/TU0maCfC-QI/AAAAAAAAAEU/qxtDZsNq9qs/s220/08122010.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5071529446265333712.post-6191968208542324358</id><published>2011-04-24T23:00:00.000-07:00</published><updated>2011-04-24T23:21:15.441-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SetAvailablePageLayouts() method'/><category scheme='http://www.blogger.com/atom/ns#' term='add layout in available layout gallery'/><title type='text'>Show only required layouts in available layout gallery - PublishingWeb.SetAvailablePageLayouts method</title><content type='html'>SharePoint have few out of the box layouts available with publishing site template. When we create a new publishing layout, that layout need to be added into the available layout gallery in order to make it available to user for creating the publishing page. This can be done through mannual steps as well as through code. SharePoint object model have &lt;strong&gt;PublishingWeb.SetAvailablePageLayouts()&lt;/strong&gt; method which can be use to set available layouts. Here is how-&lt;br /&gt;&lt;br /&gt;using(SPSite site=new SPSite(url))&lt;br /&gt;{&lt;br /&gt;PublishingSite pubSite=new PublishingSite(site);&lt;br /&gt;PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(site.OpenWeb());                           &lt;br /&gt;SPContentType associatedCType = pubSite.ContentTypes["My ContentType"];&lt;br /&gt;if (associatedCType != null)&lt;br /&gt; {&lt;br /&gt;  PageLayoutCollection allLayouts = pubSite.GetPageLayouts(associatedCType, true);&lt;br /&gt;  pubWeb.SetAvailablePageLayouts(allLayouts.ToArray(), true);&lt;br /&gt; }&lt;br /&gt;pubWeb.Update();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Thats it. The above piece of code will add all the layouts inheriting from content type &lt;strong&gt;associatedCType &lt;/strong&gt; and remove all other layouts from the available layout gallery. Only added layouts will be available for creating pages&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5071529446265333712-6191968208542324358?l=deewaker-blogs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deewaker-blogs.blogspot.com/feeds/6191968208542324358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://deewaker-blogs.blogspot.com/2011/04/show-only-required-layouts-in-available.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/6191968208542324358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/6191968208542324358'/><link rel='alternate' type='text/html' href='http://deewaker-blogs.blogspot.com/2011/04/show-only-required-layouts-in-available.html' title='Show only required layouts in available layout gallery - PublishingWeb.SetAvailablePageLayouts method'/><author><name>Deewaker</name><uri>http://www.blogger.com/profile/15690030536538037902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_YDWh2EZyP0s/TU0maCfC-QI/AAAAAAAAAEU/qxtDZsNq9qs/s220/08122010.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5071529446265333712.post-5729292147662348451</id><published>2010-12-10T01:28:00.000-08:00</published><updated>2010-12-10T03:45:21.016-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='replace webpart'/><category scheme='http://www.blogger.com/atom/ns#' term='wepart'/><category scheme='http://www.blogger.com/atom/ns#' term='create instance'/><title type='text'>Creating webpart instance from assembly name and  adding it into a webpart zone- SharePoint</title><content type='html'>We had an requirement to replace an existing webpart with a new webpart from a webpart zone on a publishing page in sharepoint portal. To accomplish this in a generic way we decided to create an utility which will use the new and old webpart DLL name. The DLL name will be passed as string. The utility will delete the existing webpart and create an instance of the webpart to be added from the DLL name.&lt;br /&gt;&lt;br /&gt;We used Assembly class to create an instance of the webpart.&lt;br /&gt;Here is the code-&lt;br /&gt;&lt;br /&gt;using System.Reflection;&lt;br /&gt;&lt;br /&gt;private static void GetWebsRecursively(SPWeb web, string pageName, string RemovedWebPartDll, string RemovedWebParttitle, string newWebPart, string IsPageOrLayout,string newWebPartTitle)&lt;br /&gt;        {&lt;br /&gt;//pageName= name of the page/layout from where webpar has to be replaced&lt;br /&gt;//RemoveWebPartDll= name of the DLL which has to be removed&lt;br /&gt;//RemovedWebParttitle= title of the webpart to be removed&lt;br /&gt;//newWebPart= DLL name of the webpart to be added&lt;br /&gt;//IsPagOrLayout= value to indicate whether the page is publishing page&lt;br /&gt;// or a layout. value would either be page or layout.&lt;br /&gt;            SPFile objFile = null;&lt;br /&gt;            string strCheckInMsg = "";&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                AppDomain domain = AppDomain.CurrentDomain;&lt;br /&gt;                AppDomain newDomain = AppDomain.CreateDomain("wpDomain");&lt;br /&gt;                DirectoryInfo dirInfo = new DirectoryInfo(@"C:\WINNT\assembly\gac_msil\" + newWebPart.Substring(0, newWebPart.LastIndexOf('.')));&lt;br /&gt;                DirectoryInfo[] dir = dirInfo.GetDirectories();&lt;br /&gt;                FileInfo[] file = dir[0].GetFiles();&lt;br /&gt;                string filePath = file[0].FullName;&lt;br /&gt;                Assembly asm = newDomain.Load(File.ReadAllBytes(filePath));&lt;br /&gt;                System.Web.UI.WebControls.WebParts.WebPart newWP = null;&lt;br /&gt;                newWP = (System.Web.UI.WebControls.WebParts.WebPart)asm.CreateInstance(newWebPart);&lt;br /&gt;                strCheckInMsg = "Modified by webpart delete console app";&lt;br /&gt;                if (PublishingWeb.IsPublishingWeb(web))&lt;br /&gt;                {&lt;br /&gt;                    PublishingWeb pWeb = PublishingWeb.GetPublishingWeb(web);&lt;br /&gt;                    if (IsPageOrLayout.ToUpper() == "PAGE")&lt;br /&gt;                    {&lt;br /&gt;                        string path = web.Url.ToString() + "/Pages/" + pageName;&lt;br /&gt;                        objFile = web.GetFile(path);&lt;br /&gt;                    }&lt;br /&gt;                    else&lt;br /&gt;                    {&lt;br /&gt;                        string path = web.Url.ToString() + "/_catalogs/masterpage/" + pageName;&lt;br /&gt;                        objFile = web.GetFile(path);&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;                &lt;br /&gt;                // If file is already in checked out state then first checkin that and  approve&lt;br /&gt;                if (objFile.CheckOutStatus != SPFile.SPCheckOutStatus.None)&lt;br /&gt;                {&lt;br /&gt;                    objFile.CheckIn(strCheckInMsg);&lt;br /&gt;                    objFile.Publish(strCheckInMsg);&lt;br /&gt;                    objFile.Approve(strCheckInMsg);&lt;br /&gt;&lt;br /&gt;                }&lt;br /&gt;                               &lt;br /&gt;&lt;br /&gt;                if (objFile.CheckOutStatus == SPFile.SPCheckOutStatus.None)&lt;br /&gt;                {&lt;br /&gt;                    objFile.CheckOut();&lt;br /&gt;                    &lt;br /&gt;                  if (HttpContext.Current == null)&lt;br /&gt;                    {&lt;br /&gt;                        HttpRequest request = new HttpRequest("", web.Url, "");&lt;br /&gt;                        HttpContext.Current = new HttpContext(request, new HttpResponse(new StringWriter()));&lt;br /&gt;                        HttpContext.Current.Items["HttpHandlerSPWeb"] = web;&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    SPLimitedWebPartManager wpMgr = SPContext.Current.Web.GetLimitedWebPartManager(objFile.Url, System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);&lt;br /&gt;                    for (int i = 0; i &lt; wpMgr.WebParts.Count; i++)&lt;br /&gt;                    {&lt;br /&gt;                        if (wpMgr.WebParts[i].GetType().FullName.ToUpper() == RemovedWebPartDll.ToUpper() &amp;&amp; wpMgr.WebParts[i].Title.ToUpper() == RemovedWebParttitle.ToUpper())&lt;br /&gt;                        {&lt;br /&gt;                            string s = wpMgr.GetZoneID(wpMgr.WebParts[i]);&lt;br /&gt;                            wpMgr.DeleteWebPart(wpMgr.WebParts[i] as System.Web.UI.WebControls.WebParts.WebPart);&lt;br /&gt;                            newWP.Title = newWebPartTitle;&lt;br /&gt;                            wpMgr.AddWebPart(newWP, s, 1);&lt;br /&gt;                            web.Update();&lt;br /&gt;                        }&lt;br /&gt;                    }&lt;br /&gt;                    objFile.CheckIn(strCheckInMsg);&lt;br /&gt;                    objFile.Publish(strCheckInMsg);&lt;br /&gt;                    objFile.Approve(strCheckInMsg);&lt;br /&gt;                }&lt;br /&gt;               &lt;br /&gt;            }&lt;br /&gt;            catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                Console.WriteLine("Error Occoured Message : " + ex.InnerException);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;This code will replace the existing webpart from new webpart provided the new webpart is present in the GAC.&lt;br /&gt;sounds very good :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5071529446265333712-5729292147662348451?l=deewaker-blogs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deewaker-blogs.blogspot.com/feeds/5729292147662348451/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://deewaker-blogs.blogspot.com/2010/12/creating-webpart-instance-from-assembly.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/5729292147662348451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/5729292147662348451'/><link rel='alternate' type='text/html' href='http://deewaker-blogs.blogspot.com/2010/12/creating-webpart-instance-from-assembly.html' title='Creating webpart instance from assembly name and  adding it into a webpart zone- SharePoint'/><author><name>Deewaker</name><uri>http://www.blogger.com/profile/15690030536538037902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_YDWh2EZyP0s/TU0maCfC-QI/AAAAAAAAAEU/qxtDZsNq9qs/s220/08122010.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5071529446265333712.post-3892828206367095484</id><published>2009-11-17T07:18:00.000-08:00</published><updated>2009-11-17T07:21:30.918-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Caching SPList'/><category scheme='http://www.blogger.com/atom/ns#' term='SPList'/><title type='text'>Caching with SPList-Sharepoint</title><content type='html'>In big sharepoint projects, it may be possible that performance of our application get reduce because of large amount of data stored in sharepoint list.In such scenario, calling Sharepoint list through sharepoint object model will harm the performance. caching can be useful in such scenario.&lt;br /&gt;To implement caching we can use PortalSiteMapProvider class. The GetCachedListItemsByQuery() method of PortalSiteMapProvider Class to get the cached data.Below is the code snippet-&lt;br /&gt;string strVal;&lt;br /&gt;SPWeb web=SPControl.GetContextWeb(context);&lt;br /&gt;SPQuery query = new SPQuery();&lt;br /&gt;query.Query = "CAML Query";&lt;br /&gt;PortalSiteMapProvider provider = PortalSiteMapProvider.CurrentNavSiteMapProviderNoEncodePortalWebSiteMapNode node = provider.FindSiteMapNode(web.ServerRelativeUrl.ToString()) as PortalWebSiteMapNode;&lt;br /&gt;SiteMapNodeCollection items = provider.GetCachedListItemsByQuery(node, "List Name", query, web);&lt;br /&gt;if (items != null)&lt;br /&gt;{&lt;br /&gt;foreach (PortalListItemSiteMapNode item in items) {&lt;br /&gt;strVal = item["column name"].ToString();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Now strVal will get the cached data.&lt;br /&gt;Alternatevely we can use HttpRunTime.cache, provided by ASP.Net, to implement caching in following way-&lt;br /&gt;SPList lstStore;&lt;br /&gt;SPListItemCollection items;&lt;br /&gt;if (HttpRuntime.Cache["configstorelist"] == null)&lt;br /&gt;{&lt;br /&gt;lstStore = web.GetList(strlistPath);&lt;br /&gt;HttpRuntime.Cache.Add("configstorelist", lstStore, null, DateTime.MaxValue, TimeSpan.FromMinutes(10),System.Web.Caching.CacheItemPriority.Default, null);&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;lstStore = (SPList)HttpRuntime.Cache["configstorelist"];&lt;br /&gt;}&lt;br /&gt;Here we will check if the Cache object is null or not. if it is null, it will call getList() method, else it will take the data from Cache object.One more point is to use GetList() method instead of SPList.Lists["name"] as SPList.Lists iterate through all the list so it may reduce the performance in large projects. So it is advisable to use GetList().&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5071529446265333712-3892828206367095484?l=deewaker-blogs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deewaker-blogs.blogspot.com/feeds/3892828206367095484/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://deewaker-blogs.blogspot.com/2009/11/caching-with-splist-sharepoint.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/3892828206367095484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/3892828206367095484'/><link rel='alternate' type='text/html' href='http://deewaker-blogs.blogspot.com/2009/11/caching-with-splist-sharepoint.html' title='Caching with SPList-Sharepoint'/><author><name>Deewaker</name><uri>http://www.blogger.com/profile/15690030536538037902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_YDWh2EZyP0s/TU0maCfC-QI/AAAAAAAAAEU/qxtDZsNq9qs/s220/08122010.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5071529446265333712.post-2011671502528851209</id><published>2009-11-16T07:14:00.000-08:00</published><updated>2009-11-17T06:45:40.205-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Accessing SPList'/><category scheme='http://www.blogger.com/atom/ns#' term='cross web application'/><category scheme='http://www.blogger.com/atom/ns#' term='sitecollection and site'/><title type='text'>Accessing SPList-cross web application, sitecollection and site</title><content type='html'>There might be some scenario where we might have to access list across site collection. We might have a situation that we have to search for a list across a site collection. We may have to check whether the list is present in any of the site collection or not and if present we may have to do some operation on the list. Below is the code snippet that may be useful in this scenario-&lt;br /&gt;private string GetListvalue()&lt;br /&gt;{&lt;br /&gt;string strVal=string.Empty;&lt;br /&gt;SPSecurity.RunWithElevatedPrivileges(delegate()&lt;br /&gt;{&lt;br /&gt;Uri uri = new Uri(SPContext.Current.Web.Url.ToString());&lt;br /&gt;SPWebApplication webApp = SPWebApplication.Lookup(new Uri("http://" + uri.Host));&lt;br /&gt;if (webApp != null &amp;amp;&amp;amp; webApp.Sites != null &amp;amp;&amp;amp; webApp.Sites.Count &gt; 0)&lt;br /&gt;{&lt;br /&gt;using (SPWeb web = SPContext.Current.Site.RootWeb)&lt;br /&gt;{&lt;br /&gt;foreach (SPSite site in webApp.Sites)&lt;br /&gt;{&lt;br /&gt;foreach (SPWeb web in site.AllWebs)&lt;br /&gt;{&lt;br /&gt;if (IfListExists(web, "List Name"))&lt;br /&gt;{&lt;br /&gt;SPList lstStore;&lt;br /&gt;SPListItemCollection items;&lt;br /&gt;lstStore = web.GetList(list path);&lt;br /&gt;SPQuery query = new SPQuery();&lt;br /&gt;query.Query = "CAML query";&lt;br /&gt;items = lstStore.GetItems(query);&lt;br /&gt;strVal = items[0]["Column name"].ToString();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;});&lt;br /&gt;return strVal;&lt;br /&gt;}&lt;br /&gt;Here I am accessing a sigle column from the first row that will be returned by the query.&lt;br /&gt;The IfListExists() method will use Linq to check whether the list exists or not. Sharepoint don't have any method or properties to check the existance of the list. Another alternative is to use the Extension Methods. Below is the definition of the IfListExists() method-&lt;br /&gt;private static bool IfListExists(SPWeb web, string listName)&lt;br /&gt;{&lt;br /&gt;return web.Lists.Cast&lt;splist&gt;().Any(list =&gt; string.Equals(list.Title, listName));&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Thats it.&lt;br /&gt;Hopes it will help. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5071529446265333712-2011671502528851209?l=deewaker-blogs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deewaker-blogs.blogspot.com/feeds/2011671502528851209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://deewaker-blogs.blogspot.com/2009/11/accessing-splist-cross-web-application.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/2011671502528851209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/2011671502528851209'/><link rel='alternate' type='text/html' href='http://deewaker-blogs.blogspot.com/2009/11/accessing-splist-cross-web-application.html' title='Accessing SPList-cross web application, sitecollection and site'/><author><name>Deewaker</name><uri>http://www.blogger.com/profile/15690030536538037902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_YDWh2EZyP0s/TU0maCfC-QI/AAAAAAAAAEU/qxtDZsNq9qs/s220/08122010.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5071529446265333712.post-843318474004021649</id><published>2009-07-29T01:27:00.000-07:00</published><updated>2009-07-29T04:42:51.567-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SPSiteDataQuery Class'/><title type='text'>Accessing multiple lists across multiple sites - SPSiteDataQuery</title><content type='html'>&lt;span style="font-family:verdana;"&gt;Sometimes, we may require to access multiple lists in multiple websites using a single query. Sharepoint provides two ways to achieve this-&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;1. joined subview using sharepoint designer ( click &lt;a href="http://deewaker-blogs.blogspot.com/2009/07/displaying-data-from-more-than-one-list.html"&gt;here&lt;/a&gt; to see)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;2. Using SPSiteDataQuery class&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;SPSiteDataQuery&lt;/strong&gt; class can be used to run CAML query across multiple lists in multiple websites within a site collection.&lt;/span&gt; &lt;span style="font-family:verdana;"&gt;It can be defined as-&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;&lt;strong&gt;SPSiteDataQuery query = new SPSiteDataQuery();&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;SPSiteDataQuery&lt;/strong&gt; class returns a &lt;strong&gt;DataTable&lt;/strong&gt; Class which can be used to access the data.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;SPSiteDataQuery&lt;/strong&gt; class has few properties which need to be set in order to use it. These properties are-&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;a. &lt;strong&gt;Lists- &lt;/strong&gt;Can be used to specify list type, lists which has to be used in query through ListID, Maximum number of lists can be used in query etc. List Type is specified by &lt;strong&gt;BaseType&lt;/strong&gt; attribute. The value of BaseType attribute will be&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;0 for a generic list&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;1 for a document library&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;3 for a discussion forum&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;4 for a survey&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;5 for a issues list.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;The Lists property can be set as&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;query.Lists="&amp;lt;Lists BaseType="'0'/"&amp;gt;";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;If we want to query some specific lists only then we must specify their list ID as below- &lt;/span&gt;&lt;br /&gt;&amp;lt;List ID=\"E8A71D9E-DDB6-4A2A-985C-976FCFBBDD23\"/&amp;gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;to get the list ID go to list setting page take the value of 'List' querystring from page URL. It will be like-&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;%7BE8A71D9E%2DDDB6%2D4A2A%2D985C%2D976FCFBBDD23%7D&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;replace %7B with '{', %7D with '}' and %2D with a '-' and we will have the list ID as&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt; {E8A71D9E-DDB6-4A2A-985C-976FCFBBDD23}.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;The maximum number of lists that the query can use will be specified by &lt;strong&gt;MaxListsLimit&lt;/strong&gt; attribute as below-&lt;/span&gt;&lt;br /&gt;&amp;lt;Lists BaseType='0' MaxListsLimit='10'&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;b. Webs Property- &lt;/strong&gt;This will specify the scope of the query. It may have any of the three values-&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;1. &lt;strong&gt;SiteCollection-&lt;/strong&gt; query will run through the whole site collection.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;query.Webs = "&amp;lt;Webs Scope="'SiteCollection'/"&amp;gt;";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;2. &lt;strong&gt;Recursive&lt;/strong&gt;- query will run within website and its child site.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;query.Webs = "&amp;lt;Webs Scope="Recursive"&amp;gt;";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;3. &lt;strong&gt;Blank&lt;/strong&gt;- query will run through current web only.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;query.Webs = "&amp;lt;Webs Scope="'"&amp;gt;";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;&lt;strong&gt;c. ViewFields property&lt;/strong&gt;- It can be used to specify the column we are going to display. It can be used a follow-&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;query.ViewFields = "&amp;lt;FieldRef Name='Department' Nullable='TRUE' /&amp;gt;&amp;lt;FieldRef Name='desc' Nullable='TRUE' /&amp;gt;"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;If we set the value Nullable='TRUE' then the query will fetch the data even if the column has null value in the corresponding row.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;&lt;strong&gt;d. Query property&lt;/strong&gt;- It is used to specify the CAML query as below-&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;query.Query="&amp;lt;Where&amp;gt;&amp;lt;Eq&amp;gt;&amp;lt;FieldRef Name="'ID'"&amp;gt;&amp;lt;Value Type=" 'Counter'"&amp;gt; 1&amp;lt;/Value&amp;gt;&amp;lt;/Eq&amp;gt;&amp;lt;/Where&amp;gt;";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;&lt;strong&gt;e. RowLimit- &lt;/strong&gt;This property will limit the number of rows which has to be fetched.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;It can be used as-&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;query.RowLimit=5; ( To limit the number of rows to 5)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;Below is the sample code to use SPSiteDataQuery-&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;SPWeb web = SPControl.GetContextWeb(Context); &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;strong&gt;SPSiteDataQuery q = new SPSiteDataQuery(); &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;strong&gt;query.Query&lt;/strong&gt; = "&amp;lt;Where&amp;gt;&amp;lt;Eq&amp;gt;&amp;lt;FieldRef Name='ID' /&amp;gt;&amp;lt;Value Type='Counter'&amp;gt;1&amp;lt;/Value&amp;gt;&amp;lt;/Eq&amp;gt;&amp;lt;/Where&amp;gt;"; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;strong&gt;query.ViewFields&lt;/strong&gt; = "&amp;lt;FieldRef Name='Department' Nullable='TRUE' /&amp;gt;&amp;lt;FieldRef Name='desc' Nullable='TRUE' /&amp;gt;&amp;lt;FieldRef Name='DepartmentLink' Nullable='TRUE' /&amp;gt;"; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;strong&gt;query.Lists&lt;/strong&gt; = "&amp;lt;Lists BaseType='0'&amp;gt;&amp;lt;List ID=\"E8A71D9E-DDB6-4A2A-985C-976FCFBBDD23\"/&amp;gt;&amp;lt;List ID=\"B59FC80A-B586-4F31-A376-2FE20896641D\"/&amp;gt;&amp;lt;List ID=\"3482EBF1-A2A7-4420%2DA920-09EA2635C557\"/&amp;gt;&amp;lt;/Lists&amp;gt;";&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;query.Webs&lt;/strong&gt; = "&amp;lt;Webs Scope='SiteCollection'/&amp;gt;";&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;query.RowLimit = 10;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;DataTable t = web.GetSiteData(query);&lt;/strong&gt;&lt;br /&gt;The DataTable will be populated by the data fetched from the list. It can be used to display the contents on the web page.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5071529446265333712-843318474004021649?l=deewaker-blogs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deewaker-blogs.blogspot.com/feeds/843318474004021649/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://deewaker-blogs.blogspot.com/2009/07/accessing-multiple-lists-across.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/843318474004021649'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/843318474004021649'/><link rel='alternate' type='text/html' href='http://deewaker-blogs.blogspot.com/2009/07/accessing-multiple-lists-across.html' title='Accessing multiple lists across multiple sites - SPSiteDataQuery'/><author><name>Deewaker</name><uri>http://www.blogger.com/profile/15690030536538037902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_YDWh2EZyP0s/TU0maCfC-QI/AAAAAAAAAEU/qxtDZsNq9qs/s220/08122010.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5071529446265333712.post-1736094440126387285</id><published>2009-07-22T23:33:00.000-07:00</published><updated>2009-07-23T02:34:14.914-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Joined Subview'/><title type='text'>Displaying data from more than one list- Joined subview in SharePoint designer</title><content type='html'>When we works with sharepoint designer, generally DataView is used to display content from sharepoint lists/libraries. We can easily display contents from a single list. But what if we have to display contents from multiple lists? Dataview has ability to display data from multiple lists. We need to create new data source which will have data from multiple lists. We need to follow some steps to accomplish this-&lt;br /&gt;1. open the site from sharepoint designer.&lt;br /&gt;2. Select data source library from right task pane and and then click on 'create a new linked source'. Below is the screen shot-&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_YDWh2EZyP0s/SmgIP9jTCQI/AAAAAAAAACg/VOaIcdGWLQY/s1600-h/taskpane.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5361544426698246402" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 387px; CURSOR: hand; HEIGHT: 362px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_YDWh2EZyP0s/SmgIP9jTCQI/AAAAAAAAACg/VOaIcdGWLQY/s320/taskpane.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_YDWh2EZyP0s/SmgHy3qt5oI/AAAAAAAAACY/MqJuYir_15w/s1600-h/taskpane.JPG"&gt;&lt;/a&gt;3. In data source properties dialogue box, click on configure linked source.&lt;br /&gt;4. A new box will appear as below. Select the lists/library that you want to link and then click on next.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_YDWh2EZyP0s/SmgJ-63pIAI/AAAAAAAAACo/dJc6kjo-fNI/s1600-h/linksourcewizard1.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5361546332943753218" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 250px; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_YDWh2EZyP0s/SmgJ-63pIAI/AAAAAAAAACo/dJc6kjo-fNI/s320/linksourcewizard1.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;5. In the linked data source wizard, there will be two options- merging and joining. Now select the second option i.e. join the contents and then click finish and then Ok. Below is the screen shot-&lt;/p&gt;&lt;p&gt;&lt;a href="http://1.bp.blogspot.com/_YDWh2EZyP0s/SmgLY8rnvCI/AAAAAAAAACw/rgn_wQ0GU70/s1600-h/linksourcewizard2.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5361547879618427938" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 250px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_YDWh2EZyP0s/SmgLY8rnvCI/AAAAAAAAACw/rgn_wQ0GU70/s320/linksourcewizard2.JPG" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Now our data source has been created. &lt;/p&gt;&lt;p&gt;6. Now open the page where you want to display the data. Add a dataview control from dataview menu to the content region.&lt;/p&gt;&lt;p&gt;7. Now click on newly created data source and then select show data as below-&lt;/p&gt;&lt;p&gt;&lt;a href="http://1.bp.blogspot.com/_YDWh2EZyP0s/SmghTOSKndI/AAAAAAAAAC4/62j77vl8dXM/s1600-h/showdata.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5361571970520096210" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 197px; CURSOR: hand; HEIGHT: 383px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_YDWh2EZyP0s/SmghTOSKndI/AAAAAAAAAC4/62j77vl8dXM/s320/showdata.JPG" border="0" /&gt;&lt;/a&gt; 8. After clicking on show data, it will display all the columns in the data source. select the columns from first list which you want to display on dataview. Drag and drop the selected column to the dataview control-&lt;/p&gt;&lt;p&gt;&lt;a href="http://4.bp.blogspot.com/_YDWh2EZyP0s/Smgn3BxxJ0I/AAAAAAAAADA/Xe_PyjL5zp0/s1600-h/column.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5361579182708041538" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 179px; CURSOR: hand; HEIGHT: 286px; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_YDWh2EZyP0s/Smgn3BxxJ0I/AAAAAAAAADA/Xe_PyjL5zp0/s320/column.JPG" border="0" /&gt;&lt;/a&gt;9. The selected column will be inserted in dataview inside TD tag. Now suppose you wants to display data from second list on the right. Then right Click on TD in designer and then select insert cell to the right as below-&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://1.bp.blogspot.com/_YDWh2EZyP0s/Smgpc8g_3II/AAAAAAAAADI/0h3qVCfqreI/s1600-h/newcell.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5361580933642181762" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 250px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_YDWh2EZyP0s/Smgpc8g_3II/AAAAAAAAADI/0h3qVCfqreI/s320/newcell.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;10. Now Select the desired columns from second list and then select "insert as joined subview" from top as below-&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://1.bp.blogspot.com/_YDWh2EZyP0s/Smgq7oFI4dI/AAAAAAAAADQ/HE1V7juH1HM/s1600-h/subview.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5361582560244195794" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 122px; CURSOR: hand; HEIGHT: 320px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_YDWh2EZyP0s/Smgq7oFI4dI/AAAAAAAAADQ/HE1V7juH1HM/s320/subview.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;11. A join subview dialog box will be open. Here we will columns from the two list which have matching data as here I used ID column-&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://2.bp.blogspot.com/_YDWh2EZyP0s/SmgsrQrqucI/AAAAAAAAADY/ILZuYXPtEkA/s1600-h/joinsubview.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5361584478108694978" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 259px; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_YDWh2EZyP0s/SmgsrQrqucI/AAAAAAAAADY/ILZuYXPtEkA/s320/joinsubview.JPG" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;After selecting the column click on Ok. Now the selected column will be inserted in the newly created TD tag.&lt;/p&gt;&lt;p&gt;Its done now. It will display data from the two list based on the value of matching column. The look and feel of the subview might not be perfect but it can be updated by doing a little modification in HTML which is generated for the joined subview and by applying custom CSS classes.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5071529446265333712-1736094440126387285?l=deewaker-blogs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deewaker-blogs.blogspot.com/feeds/1736094440126387285/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://deewaker-blogs.blogspot.com/2009/07/displaying-data-from-more-than-one-list.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/1736094440126387285'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/1736094440126387285'/><link rel='alternate' type='text/html' href='http://deewaker-blogs.blogspot.com/2009/07/displaying-data-from-more-than-one-list.html' title='Displaying data from more than one list- Joined subview in SharePoint designer'/><author><name>Deewaker</name><uri>http://www.blogger.com/profile/15690030536538037902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_YDWh2EZyP0s/TU0maCfC-QI/AAAAAAAAAEU/qxtDZsNq9qs/s220/08122010.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_YDWh2EZyP0s/SmgIP9jTCQI/AAAAAAAAACg/VOaIcdGWLQY/s72-c/taskpane.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5071529446265333712.post-6179821634239188891</id><published>2009-07-07T23:46:00.000-07:00</published><updated>2009-07-21T22:26:31.292-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySite Customization'/><title type='text'>MySIte Customization</title><content type='html'>&lt;span style="font-family:verdana;"&gt;In Sharepoint, a user can have his own personal site where he can add his personal information, documents and other related information. Sharepoint dont have any built-in mechanism to customize the look and feel of MySite template. If we wants to customiza it through Sharepoint designer then we will have to customize it for each user seperately. What if we wants to have a custom template for MySite common to all users? We will have to change its master page. The master page for MySite can be found at&lt;br /&gt;C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL\ application directory with name default.master.&lt;br /&gt;we can open it in Sharepoint designer and customize it to give look and feel. But this is not a recommended approach. If we will modify the default.master, then we will not be able to use default view of mysite anymore as we are customizing the master page from site definition.&lt;br /&gt;An alternate and recommended way to do it is feature stapling. In feature stapling, we can create a custom master page and replace that with default.master at run time using the feature.&lt;br /&gt;&lt;br /&gt;The site templates for MySite are-&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;SPSPERS (private view)&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;"&gt;SPSMSITEHOST (public view)&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;The master page for these two templates need to be replaced with our custom master page. I found a great blog by sridhar to achieve the feature stapling-&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://blogs.msdn.com/sridhara/archive/2007/05/19/customizing-mysite-in-moss-2007.aspx" target="_blank"&gt;&lt;span style="font-family:verdana;"&gt;http://blogs.msdn.com/sridhara/archive/2007/05/19/customizing-mysite-in-moss-2007.aspx&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;Using this blog I was able to customize the look and feel of master page.&lt;br /&gt;Now my next task was to add a content editor webpart in default.aspx. The solution for this is a bit tricky. I had to play with ONET.XML to add the webparts.&lt;br /&gt;&lt;br /&gt;Here is the steps I followed&lt;br /&gt;&lt;br /&gt;1. Open the ONET.XML file from the location - C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\SPSPERS\XML\ using some editor.( dont forget to take a backup of the same.)&lt;br /&gt;2. Find the Modules tag and then &lt;alluserswebpart&gt;tag 'AllUsersWebPart' .&lt;br /&gt;3. Remove all the lines inside &lt;alluserswebpart&gt;tag 'AllUsersWebPart' and add the following lines-&lt;br /&gt;http://schemas.microsoft.com/WebPart/v2&lt; /a&gt;"&gt; &lt;assembly&gt;Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&lt;/assembly&gt; &lt;typename&gt;Microsoft.SharePoint.WebPartPages.ContentEditorWebPart&lt;/typename&gt; &lt;description&gt;Use for formatted text, tables, and images.&lt;/description&gt; &lt;partorder&gt;1&lt;/partorder&gt; &lt;frametype&gt;None&lt;/frametype&gt; &lt;allowminimize&gt;true&lt;/allowminimize&gt; &lt;allowremove&gt;true&lt;/allowremove&gt; &lt;isvisible&gt;true&lt;/isvisible&gt; &lt;partimagelarge&gt;/_layouts/images/mscontl.gif&lt;/partimagelarge&gt; &lt;isincludedfilter&gt;&lt;exportcontrolledproperties&gt;true&lt;/exportcontrolledproperties&gt; &lt; xmlns="&lt; a href="&gt;http://schemas.microsoft.com/WebPart/v2/ContentEditor&lt; /a&gt;" /&gt; &lt; xmlns="&lt; a href="&gt;http://schemas.microsoft.com/WebPart/v2/ContentEditor"&gt;&amp;lt;div&amp;gt;&amp;lt;TABLE&lt; /a&gt; style="WIDTH: 100%" summary=""&amp;gt;&amp;lt;TBODY&amp;gt;&amp;lt;TR&amp;gt;&amp;lt;TD&amp;gt;&amp;amp;nbsp;Put your title here&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;&amp;lt;TR&amp;gt;&amp;lt;TD&amp;gt;&amp;amp;nbsp;your picture here&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;&amp;lt;TR&amp;gt;&amp;lt;TD&amp;gt;enter your detail&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;&amp;lt;/TBODY&amp;gt;&amp;lt;/TABLE&amp;gt;&amp;lt;/div&amp;gt;&lt; /content&gt; &lt; xmlns="&lt; a href="&gt;http://schemas.microsoft.com/WebPart/v2/ContentEditor&lt; /a&gt;" /&gt;&lt;br /&gt;&lt;/webpart&gt;]]&gt;&lt;br /&gt;&lt;br /&gt;If you dont want to see the other webpart, you can comment or remove them.&lt;br /&gt;4. save and close the ONET.XML&lt;br /&gt;5. Do an IIS reset.&lt;br /&gt;&lt;br /&gt;Thats it. Now the default.aspx will display content editor webpart.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Adding custom links&lt;/b&gt;&lt;br /&gt;To add custom left links and remove the links coming on the left, do the following-&lt;br /&gt;&lt;br /&gt;Open ONET.XML and find 'navbar' &lt;navbar&gt;tags. 'navbar'  &lt;navbar&gt;tag is for links coming on left. this tag has 'name' attribute, the value of this attribute (prefixed by dollor) is coming from resource file core.resx. we can find this file at location- C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\Resources\.&lt;br /&gt;So when we add our custom link, we will have to add them in resource file also. &lt;navbar&gt;tag also have attributes ID and URL. give an unique ID value in ID attribute and give URL of the page to the attribute URL. suppose I am adding a link Home. then &lt;navbar&gt;entry would be-&lt;br /&gt;&lt;navbar id="1019" url="#URL#" name="$Resources:core,category_MySiteHome;"&gt;&lt;br /&gt;For this, the entry in the resource file would be-&lt;br /&gt;Name -- category_MySiteHome&lt;br /&gt;value-- Home&lt;br /&gt;&lt;br /&gt;Its fine. Now comment the existing &lt;navbar&gt;tag and add your custom link by adding new &lt;navbar&gt;entry. dont forget to put an entry in core.resx file for each &lt;navbar&gt;tag you have added. Now save and close the ONET.XML. do an IIS Reset. your custom link will be visible on the default.aspx page of MySIte.&lt;br /&gt;&lt;br /&gt;'Home' will be the text appeared on the link.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Adding built-in page for custom links&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Now we have created custom link. we would like to have a custom page which will be linked to the custom link we have created.&lt;br /&gt;Create an ASP.Net Application. Add a page home.aspx into the application. In the aspx file, put proper HTML and webpart zone as you want to be on the page. If you are adding a zone then add 'webpartpages:webpartzone' tag instead of 'asp:webpartzone' tag. you may add the additional functionality and events on code behind file. give a strong name to the project and build it.&lt;br /&gt;Now we need a feature which will be used to deploy this page into mysite.&lt;br /&gt;&lt;br /&gt;First create feature.xml file. open it in a editor and add the following-&lt;br /&gt;&lt;br /&gt;&lt; ?xml version="1.0" encoding="utf-8" ?&gt;&lt;br /&gt;&lt; id="A28CE77C-7E79-49e1-867E-AF4280466BA7" title="custom pages for mysite" description="" xmlns="http://schemas.microsoft.com/sharepoint/" scope="Web" hidden="false" version="1.0.0.0"&gt;&lt;br /&gt;&lt;&gt;&lt;br /&gt;&lt; location="element.xml"&gt;&lt;br /&gt;&lt; location="home.aspx"&gt;&lt;br /&gt;&lt; /elementmanifests&gt;&lt;br /&gt;&lt; /feature&gt;&lt;br /&gt;&lt;br /&gt;Now Create element.xml file. Open it in an editor and add the following-&lt;br /&gt;&lt;br /&gt;&lt; ?xml version="1.0" encoding="utf-8" ?&gt;&lt;br /&gt;&lt; xmlns="http://schemas.microsoft.com/sharepoint/"&gt;&lt;br /&gt;&lt; url=""&gt;&lt;br /&gt;&lt; url="home.aspx" name="home.aspx" type="Ghostable"&gt;&lt;br /&gt;&lt; /File&gt;&lt;br /&gt;&lt; /Module&gt;&lt;br /&gt;&lt; /Elements&gt;&lt;br /&gt;&lt;br /&gt;Now create a folder say- MySitePages. Put feature.xml,element.xml and home.aspx file into it. put this folder in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\ directory. Take the DLL of your ASP.Net application and put it into GAC.&lt;br /&gt;&lt;br /&gt;Now we may use stsadm -o installfeature and stsadm -o activatefeature utility to deploy and activate the feature. we can activate the feature at site level after creating mysite.&lt;br /&gt;&lt;br /&gt;After activating the page will be attached to the mySite.&lt;br /&gt;Its done now. :) &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5071529446265333712-6179821634239188891?l=deewaker-blogs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deewaker-blogs.blogspot.com/feeds/6179821634239188891/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://deewaker-blogs.blogspot.com/2009/07/mysite-customization.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/6179821634239188891'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/6179821634239188891'/><link rel='alternate' type='text/html' href='http://deewaker-blogs.blogspot.com/2009/07/mysite-customization.html' title='MySIte Customization'/><author><name>Deewaker</name><uri>http://www.blogger.com/profile/15690030536538037902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_YDWh2EZyP0s/TU0maCfC-QI/AAAAAAAAAEU/qxtDZsNq9qs/s220/08122010.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5071529446265333712.post-983065330800336531</id><published>2009-06-24T23:44:00.000-07:00</published><updated>2009-06-25T02:13:48.503-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Developing Custom webpart'/><title type='text'>The two ways of developing custom webparts using .Net</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;Sharepoint comes up with some out-of-the box (OOB) webparts that can be used in sharepoint applications. In addition sharepoint is flexible enough for custom webpoarts. We can create custom webparts using .net and these webparts can be used in sharepoint pages.&lt;br /&gt;&lt;br /&gt;There are two ways to create custom webpart-&lt;br /&gt;1. using User control&lt;br /&gt;2. using class library project&lt;br /&gt;&lt;br /&gt;One may ask that which method is better. As far as I am concern, when you need a complex UI in your webpart then use user control otherwise you may use class library project.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Creating webpart using User control&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;We need to follow few steps-&lt;br /&gt;&lt;br /&gt;1. Create an ASP.Net web application and add an user control into it. Give some interesting name to it.&lt;br /&gt;2. create your UI and write your code and build your application.&lt;br /&gt;You can deploy it in two way-&lt;br /&gt;a. Using smartpart- a third party tool to add user control to your sharepoint site&lt;br /&gt;b. by deploying the DLL into GAC and putting your ASCX file into&lt;br /&gt;C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES directory.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:georgia;"&gt;&lt;strong&gt;Smartpart can be downloaded from&lt;/strong&gt; &lt;/span&gt;&lt;a href="http://smartpart.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=10697" target="_blank"&gt;&lt;strong&gt;&lt;span style="font-family:georgia;"&gt;here&lt;/span&gt;&lt;/strong&gt;&lt;/a&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Deployment using smartpart&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Take the DLL and put it in the bin folder of your web application. i.e. inside C:\Inetpub\wwwroot\wss\VirtualDirectories\port number\BIN\ directory.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Create a folder named 'UserControls' inside the web application ( inside the C:\Inetpub\wwwroot\wss\VirtualDirectories\port number\ directory) and put the ascx file in that folder.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Open the web.config. Increase the trust level to Full. we dont need safecontrol entry for user control as it will be there for smartpart.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Do an IIS reset. your user control is ready to use.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;To use it, Open the page where you want to add webpart, in edit mode. Click on 'add a webpart' in webpart zone. select smartpart from webpart zone. open the tool pane and select the user control. click on Ok. Its done now.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Deployment without Smartpart&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Sign your web Application with strong name and build it again.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;take your DLL and put it in GAC.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Take the ASCX file and put it on C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES directory.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Add a SafeControls entry into web.config.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Do an IIS reset.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Go to webpart gallery on your site and click on New tab.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Select your webpart and populate the gallery with it. Now the webpart will be in webpart gallery for use.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Creating webpart using class library project&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Follow the below steps-&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Open visual studio and create class library project.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;write your custom code for webparts and rendering controls using CreatChildControls() and Render() methods.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Sign your project with strong name.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Build the project.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Put the DLL into the GAC.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Add the SafeControl entry into the web.config file specifying the namespace and assembly.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Do an IIS reset.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Go to webpart gallery on your site and click on New tab.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Select your webpart and populate the gallery with it. Now the webpart will be in webpart gallery for use.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Thats It.&lt;br /&gt;Hopes it would be helpful for everyone.&lt;br /&gt;&lt;br /&gt;Regards&lt;br /&gt;Deewaker &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5071529446265333712-983065330800336531?l=deewaker-blogs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deewaker-blogs.blogspot.com/feeds/983065330800336531/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://deewaker-blogs.blogspot.com/2009/06/two-ways-of-developing-custom-webparts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/983065330800336531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/983065330800336531'/><link rel='alternate' type='text/html' href='http://deewaker-blogs.blogspot.com/2009/06/two-ways-of-developing-custom-webparts.html' title='The two ways of developing custom webparts using .Net'/><author><name>Deewaker</name><uri>http://www.blogger.com/profile/15690030536538037902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_YDWh2EZyP0s/TU0maCfC-QI/AAAAAAAAAEU/qxtDZsNq9qs/s220/08122010.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5071529446265333712.post-6887821498393406775</id><published>2009-06-01T04:45:00.000-07:00</published><updated>2009-06-17T23:07:18.603-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint-Exchange'/><category scheme='http://www.blogger.com/atom/ns#' term='OWA on MOSS'/><category scheme='http://www.blogger.com/atom/ns#' term='OWA-Sharepoint integration'/><title type='text'>OWA-Sharepoint Integration- A tricky solution</title><content type='html'>Hi everyone, In my recent project I had to show mails, calendar and task from exchange server on sharepoint portal. I used OWA webparts to do the same. But the problem is- OWA webparts does not show the mails, calendar and tasks instead they were showing OWA login screen. After configuring Integrated window authentication on Exchange server the problem has been resolved but within the domain. when the user logs in from outside of the domain, it doesn't works. After spending few weeks on OWA-sharepoint integration and after experiencing every alternative, I came to some tricky solution by using the below blog-&lt;br /&gt;&lt;br /&gt; &lt;a href="http://blogs.msdn.com/tconte/archive/2007/01/17/owa-web-part-with-single-sign-on.aspx"&gt;http://blogs.msdn.com/tconte/archive/2007/01/17/owa-web-part-with-single-sign-on.aspx&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;I used Single-sign-on solution from this blog. In this an HTML file has been used which is using an IFRAME control for OWA login form and submitting the credential automatically to the OWA login form. To enable SSO, I used below blog.&lt;br /&gt;&lt;br /&gt; &lt;a href="http://www.thorprojects.com/blog/archive/2008/08/02/moss-single-sign-on-setup-step-by-step.aspx"&gt;http://www.thorprojects.com/blog/archive/2008/08/02/moss-single-sign-on-setup-step-by-step.aspx&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;With the help of network administrator I was able to enable the SSO on sharepoint server.As we are authenticating the user from AD, we need to put all the user credentials into SSO database once. later when u will update the credential from AD, it will automatically be updated in SSO database. The problem with this solution is-the credentials will be passed as clear text in querystring. to resolve this I wrote some custom encryption method. As here the encryption will me server side and the decryption will be on client side so I did not tried to use built-in encryption provided in .Net. Instead I followed custom encryption as below-&lt;br /&gt;&lt;br /&gt;public string EncryptCredentials(string Cred)&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;string EncryptedCred = string.Empty;&lt;br /&gt;string[] arr = new string[10];&lt;br /&gt; for (int i = 0; i &lt; Cred.Length; i++)&lt;br /&gt;{&lt;br /&gt; arr[i] = Cred.Substring(i, 1);&lt;br /&gt; }&lt;br /&gt;for (int i = 0; i &lt; Cred.Length; i++)&lt;br /&gt; {&lt;br /&gt;switch (arr[i])&lt;br /&gt;{&lt;br /&gt;case "A":&lt;br /&gt;{&lt;br /&gt;arr[i] = "!@#$%"; &lt;br /&gt;break;&lt;br /&gt; }&lt;br /&gt;......... and so on.&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Now we need to decrypt the credentials on client side to pass it on OWA login form. I wrote some javascript decryption code to decrypt the credentials as below-&lt;br /&gt; &lt;br /&gt;function getPassword(pwd)&lt;br /&gt; {&lt;br /&gt;var len=pwd.toString().length;&lt;br /&gt;var arr=new Array();&lt;br /&gt;var i;&lt;br /&gt; var ClearPwd="";&lt;br /&gt;for(i=0;i &lt; len;i+=5)&lt;br /&gt; {   &lt;br /&gt; arr[i]=pwd.toString().substring(i,i+5);&lt;br /&gt;}&lt;br /&gt;for(i=0;i &lt; len;i+=5)&lt;br /&gt; {   &lt;br /&gt; switch (arr[i])   &lt;br /&gt;                {        &lt;br /&gt;               case "!@#$%":  &lt;br /&gt;                         {       &lt;br /&gt;                        arr[i] = "A";    &lt;br /&gt;                           break;   &lt;br /&gt;                        } .......&lt;br /&gt;n so on&lt;br /&gt; }&lt;br /&gt;ClearPwd+=arr[i];&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt; Here the encrypted credential has been taken into array of string each having length five. This will again decrypt the credentials and that will be passed to OWA login form. Now the credential is being decrypted and can be passed to login form of OWA. Also, it will not be visible to anyone as a clear text. Its done Now. you may use the webpart now. hopes it will help. :) &lt;br /&gt;&lt;br /&gt;Regards&lt;br /&gt;Deewaker&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5071529446265333712-6887821498393406775?l=deewaker-blogs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deewaker-blogs.blogspot.com/feeds/6887821498393406775/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://deewaker-blogs.blogspot.com/2009/06/owa-sharepoint-integration-tricky.html#comment-form' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/6887821498393406775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/6887821498393406775'/><link rel='alternate' type='text/html' href='http://deewaker-blogs.blogspot.com/2009/06/owa-sharepoint-integration-tricky.html' title='OWA-Sharepoint Integration- A tricky solution'/><author><name>Deewaker</name><uri>http://www.blogger.com/profile/15690030536538037902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_YDWh2EZyP0s/TU0maCfC-QI/AAAAAAAAAEU/qxtDZsNq9qs/s220/08122010.jpg'/></author><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5071529446265333712.post-5882116537823725979</id><published>2009-05-25T00:04:00.000-07:00</published><updated>2009-06-17T03:34:38.682-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='custom breadcrumbs in sharepoint 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='breadcrumbs'/><title type='text'>Custom breadcrumb in sharepoint 2007</title><content type='html'>&lt;span style="font-family:verdana;color:#003333;"&gt;Hi every one,&lt;br /&gt;&lt;br /&gt;In my recent sharepoint project,I need to use the breadcrumbs but the default breadcrumb provided in sharepoint is less flexible. For example if your pages are in 'Pages' directory then in the bradcrumb, there will be a link for 'pages' directory also which in most of the cases we dont want end user to view. The SiteMapPath control from ASP.net can be used to create a custom breadcrumb but I used an easy approach(as i felt) for it. I used C# and write some code as below-&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;String[] nav = null;&lt;br /&gt;string[] navUrl = null;&lt;br /&gt;nav = new string[10];&lt;br /&gt;navUrl = new string[10];&lt;br /&gt;int i = 0;&lt;br /&gt;SPWeb web = SPControl.GetContextWeb(Context);&lt;br /&gt;if (web.IsRootWeb == true)&lt;br /&gt;{&lt;br /&gt;nav[0] = web.Title;&lt;br /&gt;navUrl[0] = web.Url.ToString() + "/" + SPContext.Current.File.Url.ToString();&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;while (!web.IsRootWeb)&lt;br /&gt;{&lt;br /&gt;nav[i] = web.Title;&lt;br /&gt;navUrl[i] = web.Url.ToString() + "/Pages/Default.aspx";&lt;br /&gt;web.Title = web.ParentWeb.Title;&lt;br /&gt;web = web.ParentWeb;&lt;br /&gt;i++;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;nav[i] = web.Title;&lt;br /&gt;navUrl[i] = web.Url.ToString() + "/" + SPContext.Current.File.Url.ToString();&lt;br /&gt;}&lt;br /&gt;string navigationStr = string.Empty;&lt;br /&gt;navigationStr = "&lt;/span&gt;&lt;a href="http://www.blogger.com/post-edit.g?blogID=5071529446265333712&amp;amp;postID=5882116537823725979#"&gt;&lt;span style="font-family:verdana;color:#003333;"&gt;Home&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;color:#003333;"&gt;";//set the home link&lt;br /&gt;&lt;br /&gt;while (i &gt; 0)&lt;br /&gt;{&lt;br /&gt;navigationStr = navigationStr + "&gt;" + "&lt;/span&gt;&lt;a href="http://www.blogger.com/post-edit.g?blogID=5071529446265333712&amp;amp;postID=5882116537823725979#"&gt;&lt;span style="font-family:verdana;color:#003333;"&gt;" + nav[i - 1] + "&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;color:#003333;"&gt;";&lt;br /&gt;i--;&lt;br /&gt;}&lt;br /&gt;navigationStr = navigationStr + "&gt;" + SPContext.Current.File.Title;&lt;br /&gt;Table tblMain = new Table();&lt;br /&gt;mainDiv.Controls.Add(tblMain);// mainDiv is a DIV tag works as container for the table&lt;br /&gt;TableRow trMain = new TableRow();&lt;br /&gt;tblMain.Rows.Add(trMain);&lt;br /&gt;TableCell tdBrad = new TableCell();&lt;br /&gt;trMain.Cells.Add(tdBrad);&lt;br /&gt;tdBrad.Text = navigationStr;&lt;br /&gt;}&lt;br /&gt;catch&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;thats it. I put this code in an user control and deployed that control using smartpart(a third party tool). we may also create a class library project to create webpart for breadcrumb.&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;span style="font-family:verdana;color:#003333;"&gt;Hopes It will be helpful for needy people. :)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;color:#003333;"&gt;Regards&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;color:#003333;"&gt;Deewaker&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5071529446265333712-5882116537823725979?l=deewaker-blogs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deewaker-blogs.blogspot.com/feeds/5882116537823725979/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://deewaker-blogs.blogspot.com/2009/05/custom-bradcrumb-in-sharepoint-2007.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/5882116537823725979'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5071529446265333712/posts/default/5882116537823725979'/><link rel='alternate' type='text/html' href='http://deewaker-blogs.blogspot.com/2009/05/custom-bradcrumb-in-sharepoint-2007.html' title='Custom breadcrumb in sharepoint 2007'/><author><name>Deewaker</name><uri>http://www.blogger.com/profile/15690030536538037902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_YDWh2EZyP0s/TU0maCfC-QI/AAAAAAAAAEU/qxtDZsNq9qs/s220/08122010.jpg'/></author><thr:total>3</thr:total></entry></feed>
