Deleting User Alerts in Sharepoint (MOSS 2007)

Setting alerts in MOSS 2007 is very easy just go to any list or library right click on Actions Tab and the last option available is the Alert Me feature. Configuring these alerts is very simple and is a child’s play but customizing the alert emails which are sent and sending list specific email alerts and stuffs like this are little bit tricky. Don’t worry here we are not discussing those horrifying issues but here we are simply going to discuss on how to delete the alerts which user has set on a particular list. There is a very simple process to do this you don’t need to write code for that but i am sharing this with you as for the novice programmer it’s a tedious task to find actually where to go to delete these alerts.

  • Just go to “Site Actions” on the top right corner of your sharepoint site and then click “Site Settings”.

 

  • Now look for the Site Administration section under that look for the User Alerts.

  • Once the User Alerts page is opened select a user for which you want to delete the alert, as you select the username from the dropdown list then all the alerts related to that user will be displayed.
  • Now you can select single or multiple alerts and click on the “Delete Selected Alert” link to delete the selected alert.

Stay tuned for more articles on Sharepoint (MOSS 2007) Happy Programming!!!!!!!!!!!!!!!!!!!


Finding and changing the default timer interval for timer jobs in Sharepoint

Many times we need to change the default timer settings either by increasing the default time or by decreasing the default time of the timer jobs for a particular sharepoint site. Particularly if you want to send an email as soon as an action is performed within the sharepoint, in such a scenario you will need to decrease the default timing of the timer job. There are two commands by which you can achieve this very easily:-

  1. Finding the default time of the timer job, the delay in sending mails could be due to the default timing of the timer jobs which is by default 5 minutes.
  2. Decreasing the default time of the timer job to 1 minute.

That’s all you need to do to adjust the default timer job timing delays. Happy Programming!!!!!!!!!!!!!!!!!


Renaming MOSS 2007 or Sharepoint Server

Many times there are situations when you have to rename a MOSS installation either in your virtual PC environment and also sometimes in production, although the production one is little uncommon but the point is a sharepoint developer at one point or other want’s to rename his sharepoint server. Renaming the server simply will screw up all the settings inside the sharepoint as many places there are hardcoded references to the previous server which has to be remapped in order to run the MOSS server with the new server name. Here in this article i will explain you the step by step process for renaming the MOSS server.There are few resources available on the net which helps you in achieving the same but it was hard for me to find a good resource, so i thought to pen it down so that it can help everyone using Sharepoint. Steps:-

  1. Change Alternate Access Mappings
  2. Run stsadm for renaming the server.
  3. Rename the server physically on windows explorer.
  4. Reboot the server
  5. Update login credentials
  6. Restart IIS
  7. Change identity references in IIS
  8. Reconfigure search index

1.Change Alternate Access Mappings This is the first and foremost step to rename the Sharepoint server.Alternate access mappings can be found at Central Administration>Operations>Alternate Access Mappings Click on the web application url and edit the url to have the new server name.This you have to do manually for every website.   2.Run stsadm for renaming the server. You have to rename the server using stsadm before actually or physically renaming the sharepoint server. The command to rename the server is “stsadm –o renameserver –newservername “[yournewservername]”   -oldservername “[youroldservername]“ ” and this is also shown in the figure below:- stsadm can be found in “C:ProgramFilesCommon FilesMicrosoft Sharedweb server extensions12bin Developers can set the path to be globally accessible for ease of using stsadm instead of navigating to the whole path.How to configure environment variables in order to get the stsadm available globally can be found here :- https://www.smallworkarounds.com/index.php/2009/07/19/sharepoint-quick-tip-add-stsadmexe-to/ 3.Rename the server physically in the windows explorer For this step just right click on the My Computer icon in the start menu and click on properties then on the Computer Name tab just click Change button and rename it to whatever new name you want to give to your sharepoint server installation. 4.Reboot the server After following all the 3 steps mentioned above just reboot your sharepoint server. 5.Update Login Credentials Updating credentials is must as sharepoint server is still mapped to the old username inside the domain and will thus cause problems.To update credentials we will again use stsadm.exe “stsadm –o updatefarmcredentials –userlogin “newservernameusername” –password “yourpassword”   6.Restart IIS IIS needs to be restarted in order to reflect the changes which we have just made in the above steps. Remember to restart the IIS using iisreset/noforce from the command prompt. 7.Changing Identity references in IIS After doing all these changes still sharepoint website’s application pools are mapped to the old username and servername which were used to install the Sharepoint inside the farm.So in order to get rid of this old server name we have to manually change the Identity references in the IIS. Remember if the identity says “Predefined” and the value is set to Network Service then there is no need to play and touch those settings, let them be like that only.     But if the Identity is configurable then you have to replace the old servername with the new servername in the username section and if you want to change the password then you have to type the password and retype it to confirm and press ok After this step almost everything is done you just have to configure search index to function properly. 8.Reconfigure Search Index After renaming the sharepoint server the search index have to be reconfigured the best possible solution is to drop the search index and rebuild it.
After doing all these changes you may still find at some places where few links are referencing your old server name and clicking those links does nothing more then giving a blank page to user saying nothing exists on the server like that which he is asking for. In such scenarios you have to use your hit and trial method and have to find the root element which is causing this trouble and definitely that would be configurable just you have to figure out which is the right spot to configure this. After doing this you might face problems with MySite which can be fixed once editing the People & Groups section of the MySite administration. At last you can navigate through various pages to check that whether your MOSS 2007 server is working or not. Disclaimer :- This article is based on my testing under my virtual environment things may vary and i advice not to test and play with your production farm sharepoint installations as this might damage your sharepoint server. Happy Programming !!!!!!!!!!!!!!!!!!


Integrating Silverlight 2.0 with Sharepoint MOSS2007

Silverlight is a revolutionary technology and its much in demand these days,Sharepoint is an old player but very extensive and offer a lot of features which make it alluring for medium to large enterprise. Sharepoint already provide a lot of out-of the box features but as silverlight is catching up every now and then you will have a requirement from the client to integrate silverlight with sharepoint. So in this article i will tell you how to integrate silverlight with sharepoint.Although there can be various ways of doing so i m following the webparts approach as it seems simple to me there are other simple approaches in which we can add a contentweb part in which we can give the source of the iframe as an hosted xap on silverlight live streaming server’s but being a developer this approach seems to me a little creepy and also there are very few resources which clearly tell how to integrate silverlight 2.0 into Sharepoint or MOSS2007.

  1. Create a silverlight 2.0 application and copy the xap and project .dll file in a separate folder.
  2. Configure MIME Types on the sharepoint server to accept .xap,.xaml,.xbap file extensions.
  3. Change the web.config of the application or website where you want silverlight to be integrated.
  4. On the sharepoint server create a WebPart project.
  5. Copy the resources i.e xap and the project dll file in the directory specified in the web part project silverlightcontrol source
  6. Deploy the webpart project to the required site where you want silverlight to show up.
  7. Edit the page where you want to add the silverlight control and click add webpart and you are done.

 

  1. Create Silverlight 2.0 application
    • Create a silverlight 2.0 application and build that solution and copy and past its xap file and the project dll file into another folder whose content we will copy later into the wwwroot and website name of the sharepoint site where we want to deploy this silverlight application.
  2. Configure MIME types in IIS on the sharepoint server
    • If you don’t have mime types configured on your iis server on the machine where you have your sharepoint installed, then first step is to configure the mime types on the IIS.
    • For IIS 6 you can either right click on whole of the website section or on specific website where you want the mime types to be configured.After right clicking go to the http header section from there select the mime types.

    • After selecting mime types click on new if the silverlight mime types are not present.

    • Add all the three mime types shown in the above figure and then click ok.Now your IIS is configured to accept and render xaml, xap and xbap

3.Change the web.config file of the sharepoint website for which you want to integrate silverlight.

    • This is very important step because if you leave this step in between even if you do all other things correctly then also nothing will get rendered in the final webpart when you deploy the webpart and include it on your page.
    • So we have to follow a little hacky approach in order to get the configuration file correct.
    • So first step is open your visual studio and create a new asp.net 2.0 application

    • We are creating asp.net 2.0 application because sharepoint is using mostly asp.net 2.0 references and it’s not having any web.config enteries related to silverlight and ajax features of the 3.5 framework.
    • It is recommended to make a copy of the web.config so that if any error occurs you can restore the original version.
    • Now we should open the web.config of the sharepoint website in the same solution.web.config of the sharepoint website can be found at “c:inetpubwwwrootwssVirtualDirecotriesyourwebsitenameweb.config”
    • Open this web.config and copy and paste the content in the original asp.net 2.0 web application web.config.
    • Now right click on the web project and click properties and change the target framework to .net framework 3.5 and then save the web.config file for the sharepoint website.

    • Now you have to add the following two entries in your web.config, first one is in the <system.web><compilation><assemblies> section add the below line
<add assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    • Next entry to be added is in the <system.web><pages><controls> section just add the line as given below
<add tagPrefix="asp" namespace="System.Web.UI.SilverlightControls" assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    • After adding these two entries just save the web.config file and you are done with the web.config changes.

4.Create a webpart project on the sharepoint server

    • For creating a web part project in Visual Studio 2008 you need to install  “Windows SharePoint Services 3.0 Tools: Visual Studio 2008 Extensions, Version 1.2” which can be downloaded from here
    • After installing WSS3.0 tools Visual studio extensions you will have a new Sharepoint project type in C# section,from there choose webpart project and give your project some name.

    • Delete the default webpart folder which will be created and click on the add new item and then select webpart from the list.

    • Add two references to this project one is System.Web.Extensions and the other one is System.Web.Silverlight

 

    • In the yourwebpartname.cs file make changes so that it should look similar in code as given below
using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.SilverlightControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;

using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;

namespace TangramWP
{
    [Guid("6b31932f-7245-4d78-912c-56033008e775")]
    public class TangramSilverlightWP : System.Web.UI.WebControls.WebParts.WebPart
    {
        private Silverlight silverlightControl = null;
        public TangramSilverlightWP()
        {
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);
            if(scriptManager==null)
            {
                scriptManager = new ScriptManager();
                this.Controls.AddAt(0,scriptManager);
            }
        }
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            silverlightControl = new Silverlight();
            silverlightControl.ID = "TangramSilverlight";
            silverlightControl.Source = "/Bin/Tangram.xap";
            silverlightControl.Width = new Unit(500);
            silverlightControl.Height = new Unit(400);
            Controls.Add(silverlightControl);
        }
    }
}

5.Copy resources such as xap and the project dll inside the specified location inside the sharepoint website.

    • Now in the bin directory of your sharepoint website just copy your .xap file and the silverlight application which is in my case Tangram.dll.

6.Deploy the web part solution created

    • Right click on the solution and click properties in the debug section just change the “Start Browser with url” with the location of your sharepoint website.

    • Right click on the webpart solution which you have created and just click deploy to deploy the solution to the sharepoint website.

    • After successful deployment click on the edit page section in the site actions of your website and select the web part which you just deployed its generally in the miscellaneous section.

If all goes well and you have followed each step you will see the silverlight application rendered in your webpart.

Happy Programming!!!!!!!!!!!!!!!!!!!!


Sharepoint Quick Tip:- Add stsadm.exe to your environment variables to execute it from anywhere

This is a very small but tremendously useful tip for the beginners of WSS 3.0 or MOSS 2007.Especially when you are using the free version WSS 3.0 many times you need to use this command line utility call stsadm.exe. As you need it many times every time you need to navigate to its directory which is “C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12bin” So as a quick workaround what you can do to save your time is to set this path in environment variables section. Just right click on your MyComputer and select Properties   In the advanced section select environment variables and then below select the path.In the path put semi-colon after the last entry and add one more path as c:Program FilesCommon FilesMicrosoft Sharedweb server extensions12bin. After doing this just click OK and you are done. Now you can run stsadm.exe from anywhere in the command prompt as it’s available globally as an environment variable. This tip is meant for a sharepoint newbie.