Ana içeriğe atla


Kasım, 2010 tarihine ait yayınlar gösteriliyor

SharePoint 2010 - Send Notification on Item Approved/Rejected (when Content Approval Status is changed)

In SharePoint 2010 new improvements are made for better event receiving management. Few new event handlers are added for site, web, list, listitems etc. However, One thing that I think badly needed was the content approval events  for list items. Nowadays content approval has become an integral part of content management system. Requirements has come up to do more work on content approval/reject. But unfortunately, SharePoint list/library doesn’t have events like ContentApproved, ContentRejected, ContentRequestedForReview so that user can tap the events to do their own work on content approval status changes. So it seems we need to do a lot of works manually to send notifications on content approval status changes. Problem: Approving Status change events Missing One of my client wanted to get notification on the following scenarios: 1. On Item Add/Update: If a user edit an item and item goes to pending status as the item needs approval, the approving teams need to be notified

Move SharePoint Site/Web From One Development Server to Another

Sometimes, we need to move the site from one server to another, usually in development environment. In that case its required few steps to make sure you have moved your site in new server. I have successfully move my sites and I’m pointing here the exact steps that worked for me. Backup the site or export the web First of all you need to take backup of the site (if you want to move site collection). If you want to move a single site then export the web contents. For site backup use the following command: Backup-SPSite -Identity -Path "C:\Backup\BackupFile.bak" -Confirm:$false For exporting web use the following command. Export-SPWeb –Identity –Path “C:\Backup\BackupFile.cmp” –Confirm:$False For more on these commands follow MSDN link . Create Dummy site or web on the destination server to overwrite Before restoring or importing site/web you need to create a dummy site/web on the destinati

SharePoint Error: The exported site is based on the template STS#1 but the destination site is based on the template STS#0

Today I was trying to export one of my site from one Virtual machine to another. First I took a export of the web from my source server and then I tried to import the content in the destination server. And then the import failed with the error “ The exported site is based on the template STS#1 but the destination site is based on the template STS#0 ”. I couldn’t remember the template with which I created the source site but I took for granted from the error message that the source and destination web are not created from the same template. After googling I finally found import will only work if source and destination web are created from the same template. In my case the source site was created from Blank Site template (STS#1) but the destination site was created from Team site template (STS#0). So I deleted the destination site and recreated with the source template and the import was successful. For full lists of web site templates you can follow Aravindhan’s   posts.

SharePoint 2010 - Rename Site Url

Sometimes in development environment and even in production you may need to rename a site url. For example you have planned a site with URL in Development or in Production. Later you have decided to rename the site url to . There’s no shortcut way to do that in SharePoint. You need to delete the existing web application for url and create a new one with url . 1. Backup the site collection first Run the following powershell command to backup site. Backup-SPSite –Identity SiteUrl –Path BackupLocation 2. Delete the existing site from central admin. Navigate to central admin and delete the web application including database and IIS site as shown below: 3. Create the a new site with new Url (say ) Now create a new web application with the new url in host header as shown below: 4. Restore the backup on the new site Finally restore the backup taken on step 1 overwriting the new sit

Linq to SharePoint

SharePoint 2010 has added new Linq extension called Linq-to-SharePoint similar like Linq-to-Sql. In Linq to Sql, when you Visual Studio generate classes based on your database schema, under the hood a tool called SqlMetal is used. Though VS generates classes for you, you can use SqlMetal outside of VS for your own purpose. Linq to SharePoint is new extension which allows to generate DataContext (having classes representing lists) based on your sharepoint lists using SPMetal and you can use the DataContext for manipulating SharePoint list in an object-oriented fashion. So you don’t need to worry about CAML or SharePoint Object Model. The steps to work with Linq-to-SharePoint is easy. Let’s dig it deeper. Generate Linq-to-SharePoint DataContext class : To use Linq to SharePoint you need to use SPMetal to generate Linq-To-SharePoint class. You can find the SPMetal in the location “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN”. You can run the command fr

WindowsFormsHost: Host ActiveX and windows form controls in WPF

If you ever need to host ActiveX control in your wpf application then you can do it by using WindowsFormsHost control. Also sometimes you may need to add windows form control in WPF. you may have developed some controls in windows form technology and you don't want to rewrite this for WPF. WindowsFormsHost control can save you for this time. The following steps describes what to do to add ActiveX or windows form control in wpf application: 1. Add reference to WindowsFromsIntegration assembly which is WindowsFormsIntegration.dll. This is the assembly where WindowsFormsHost control is defined. So if you add WIndowsFormsHost control before adding the assembly reference you''ll find that the WindowsFormsHost control is not recognized in XAML (if you just drag and drop the control form toolbox). 2. Add reference to windows forms assembly which is You also need to add the namespace in XAML file as shown below: xmlns:wf="clr-namespace:System

SharePoint 2010: Client Object Model – an Introduction

SharePoint 2007 allows using its Object model to run against server running SharePoint. For clients (not running SharePoint in the box) the simplest way to communicate with SharePoint server is web services. SharePoint Client Object Model (OM) can be run on client PC (where SharePoint is not installed) to communicate with SharePoint server. So whereas SharePoint (Server) Object Model runs in a SharePoint server and can manipulate SharePoint objects, Client OM can run in client PC and communicate with SharePoint server remotely. SharePoint 2010 introduces three new client APIs which can be used to interact with SharePoint sites. The three APIs are targeted for three different types of clients: 1. For .net Managed applications (for example, console applications, window applications, web applications etc, which are not running inside SharePoint Context). 2. For Silverlight applications. 3. For using with JavaScript (called ECMAScript). This API is only available for applications h

SharePoint 2010: Metadata Service

In SharePoint 2010 two metadata related supports are added which were a big challenges in SharePoint 2007. One Challenges I faced personally was not having the support of taxonomy or hierarchical metadata. Another challenges was the metadata could not be shared across site collection boundaries. So in SharePoint 2010 the following two new features are added to solve the issues: 1. Taxonomy Support: Taxonomy is a mean of managing data in hierarchy. Though other CMSs have this taxonomy support out of the box, till SharePoint 2007 we had not this support out of the box. But SharePoint 2010 has this support built in. We can now use hierarchical metadata to tag content in SharePoint 2010. 2. Shared Metadata Prior to SharePoint 2010 there was no way to share metadata across site collection boundaries. So if you ever needed to share metadata then you would go and copy the same metadata in different site collection. Now in SharePoint 2010 there’s a shared service called “Shared Metadat

SharePoint 2010 Error: System.Web.HttpException: Directory 'C:\inetpub\wwwroot\wss\VirtualDirectories\80\_catalogs\masterpage' does not exist.

I had got the error when I tried to use pagemethods in SharePoint. I had registered the AjaxControlToolkit namespace in masterpage and then I replace ScriptManager with AjaxControlToolkit’s ToolkitScriptManager as shown below: <ajaxToolkit:ToolkitScriptManager id="ScriptManager" runat="server" EnablePageMethods="true" EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true"/> The problem was I enabled the pagemethods by setting EnablePageMethos to true. Disabling the pagemethods fixed the issue. However I didn’t explore why there’s the error if pagemethods is enabled. So disable the pagemethods by setting EnablePageMethods=”false” and then then error will disappear…

SharePoint 2010 Error: Cannot make a cache safe URL for "1031/styles/Themable/corev4.css", file not found. Please verify that the file exists under the layouts directory.

I had to take backup from my client’s production site to make some analysis in my local server. So I took backup and restored the site in local server. Restored was successful. Then I changed the site collection administrator of the restored site as it was still pointing to the production server’s site collection administrator. Then I tried to browse the site and found the interesting error “Cannot make a cache safe URL for "1031/styles/Themable/corev4.css", file not found. Please verify that the file exists under the layouts directory.” The very first thing I noticed the path contains 1031. Anyone can guess that this is language id and thought came to my mind is that my client SharePoint site not in English. The production site was in German language and when I restored the site, its looking for resources in German language ID folder. Then I download the language pack from MSND and refreshed the browser. It worked like magic….

SharePoint 2010 - Adding a custom control to the Team Site Wiki Page Template ( wkpstd.aspx ) programmatically

This is maybe my last post about the Team Site Wiki Page customization with the aim of exceeding its limitations. This time we are going to customize the unique template ( wkpstd.aspx) by replacing the control that renders the editable content by a custom one. In this post example, we will take advantage of the use of this custom control to render not editable additional contents, for instance, a header and a footer that could be the same for a specific Wiki Page Library. Of course, we are not going to really customize the template, but we are going to use a delegate control to replace the control at runtime. Here are the screen shots of the result: We can see a non editable Header and Footer on the Team Site Wiki Page In edit mode these additional contents are not rendered, but we can add new content as usual And of course, after having saved the page, the new content is rendered wtih the non editable Header and Footer. Steps required  If you look at the Te