Category Archives: MOSS 2007

MOSS 2007 Post

VSeWSS 1.3 – System.UnauthorizedAccessException: Attempted to perform an unauthorized operation.

When deploying your SharePoint solution via Visual Studio 2008 you may see the error “System.UnauthorizedAccessException: Attempted to perform an unauthorized operation.”

This is the related to the Visual Studio 2008 Extensions for Windows SharePoint Services 3.0, v1.3 March 2009 CTP, MOSS 2007.

To resolve this issue do the following:

  • Create a new account using Computer Management in Administrative tools (Active Directory Users and Groups)
  • Add the new account to the following groups:
  • 1. Administrators
    2. IIS_WPG
    3. WSS_ADMIN_WPG
    4. WSS_RESTRICTED_WPG
    5. WSS_WPG
    6. SQLServer2005MSSQLUser$

  • Open a Visual Studio 2008 command prompt and enter: ASPNET_REGIIS –ga DOMAIN\USER (this is the user account you created in the previous step)
  • Use Internet Information Services (IIS) Manager from Administrative Tools
  • Create a new Application Pool called ‘VSeWSS’ and enter the new user account and password created above to run it
  • Install VSeWSSv13_x86_Build-433.exe which can be downloaded from here: http://www.microsoft.com/en-au/download/details.aspx?id=21082
  • During the installation process it will ask for the Application Pool, select the default Application Pool and type in the name of the new Application Pool created above ‘VSeWSS’
  • Continue with the installation as normal.
  • Before you deploy your solution, go to your root site collection on your virtual machine or the rool site collection of your intranet. Then go to Site Actions > Site Settings > Site Collection Administrators and add the new user account created above as a Site Collection Adminstrator. If you don’t do this you are likely to see ‘System.UnauthorizedAccessException: Attempted to perform an unauthorized operation.’ error in the log file.
  • Lastly, build and deploy your solution using Visual Studio 2008.
MOSS 2007 Post

CoolWriteups Solved: SharePoint Redirect From NewForm.aspx

Hello

Have you ever had the need to redirect your NewForm.aspx page to a custom page or another page in your site?

The solution is:

Place the following javascript code after the
<asp:Content ContentPlaceHolderId=”PlaceHolderMain” runat=”server”>

Add this code after the line above in your NewForm.aspx page.
<script type=”text/javascript” language=”javascript”>
function PreSaveAction() {
var srcUrl=GetSource();
var newSrcUrl = “http://www.yournewpage.aspx“;
var i = aspnetForm.action.lastIndexOf(srcUrl);
aspnetForm.action = aspnetForm.action.substring(0,i) + newSrcUrl ;
return true;
}
</script>

And that’s it. Good luck 🙂

 

MOSS 2007 Post

CoolWriteups Solved: SharePoint 2007 CSS Stylesheet works for some users only.

Hello

You may notice that when you set a custom stylesheet for your MOSS 2007 website by going to:

Site Settings > Master Page and at the bottom of the page in the “Specify a CSS file to be used by this publishing site and all sites that inherit from it”

    Some users (especially you) as you may be logged in as an Administrator, will see the new style sheet take effect. Unfortunately your end users may still be seeing the default layout.

    Solution:

    Ensure that the path to the style sheet is correctly pointing to the Style Library folder or any other folder you have used to store your style sheets;

    Hover over the style sheet in the Style Library folder, click the little arrow to open the properties for the file, and click “Publish a Major Version”;

    If the above doesn’t work, chances are your end users do not have Read access to the Style Library folder. You can give them access by going to the Style Library folder > Settings >  Document Library Settings > Permissions for this document library and granting them Read access only.

      We love your comments so let us know what you think 🙂

      Good luck.

      MOSS 2007 Post

      CoolWriteups Solved: Turning Off Attachments Option For Lists In SharePoint 2007

       

      Hello

      Disabling Attachments for a list is very simple to do but can be tricky to find for those who have only recently started using MOSS 2007.

      To disable Attachments in a List do the following:

      • Open the List;
      • Click Settings > List Settings to open the settings window for the list;
      • Click Advanced Settings and in the new window click the “Disabled” option for Attachments.
      • While you’re there you can also configure Search and a host of other options.

      Good luck and happy coding.

      We love your comments so please feel free to let us know what you think below 🙂

      CoolWriteups Solved: Display Current Month And Year In SharePoint 2007 NewForm.aspx Using jQuery

       

      Hello

      Recently I had a requirement to display the current month and year along with the next month and year as text values in a SharePoint 2007 list form, specifically the NewForm.aspx. There is no out of the box way of doing this, so the best way to approach this is to use the rich and abundant features provided by jQuery. Below is a screenshot of the end result.

      JQuery Display Next Months and Years

      If you are not familiar with JQuery then I suggest you take a look at http://www.jquery.com and read what JQuery can do for you.

       

       

       

       

       

      So, let’s begin….

      • Open the NewForm.aspx page of your custom list in a web browser such as Internet Explorer;
      • Click Site Actions > Edit Page (If you don’t see the Edit Page option, in your address bar after the “?” add ToolPaneView=2&View=Shared);
      • Add a Content Editor Web Part to the page, either above or below the existing web part;
      • Click Modify Shared Web Part to the right of the new web part;
      • Then click the Source Editor button to open the black editor and add the following code:

       

      <code>

      <script type=”text/javascript” src=”http://code.jquery.com/jquery-latest.js”></script>

      <script type=”text/javascript”>

      $(document).ready(function(){
      var m_names = new Array(“January”, “February”, “March”,
      “April”, “May”, “June”, “July”, “August”, “September”,
      “October”, “November”, “December”);

      var d = new Date();
      var curr_date = d.getDate();
      var curr_month = d.getMonth();
      var next_month1 = d.getMonth()+1;
      var next_month2 = d.getMonth()+2;
      var next_month3 = d.getMonth()+3;
      var curr_year = d.getFullYear();
      //var currentTime=new Date();
      //var month=currentTime.getMonth()+1;

      $(‘#ctl00_m_g_b396cc2e_a45b_4062_8170_28b3e76064d0_ctl00_ctl04_ctl01_ctl00_ctl00_ctl04_ctl00_ctl00_TextField’).val(m_names[curr_month]); //this month

      $(‘#ctl00_m_g_b396cc2e_a45b_4062_8170_28b3e76064d0_ctl00_ctl04_ctl04_ctl00_ctl00_ctl04_ctl00_ctl00_TextField’).val(m_names[next_month1]); //next month 1

      $(‘#ctl00_m_g_b396cc2e_a45b_4062_8170_28b3e76064d0_ctl00_ctl04_ctl02_ctl00_ctl00_ctl04_ctl00_ctl00_TextField’).val(curr_year); //current year

      $(‘#ctl00_m_g_b396cc2e_a45b_4062_8170_28b3e76064d0_ctl00_ctl04_ctl05_ctl00_ctl00_ctl04_ctl00_ctl00_TextField’).val(curr_year); //next year 1

      $(‘#ctl00_m_g_b396cc2e_a45b_4062_8170_28b3e76064d0_ctl00_ctl04_ctl08_ctl00_ctl00_ctl04_ctl00_ctl00_TextField’).val(curr_year); //next year 2

      });

      </script>

      </code>

      To find the ID (ctl00_m_g_b396cc2e_a45b_4062_8170_28b3e76064d0_ctl00_ctl04_ctl08_ctl00_ctl00_ctl04_ctl00_ctl00_TextField) of a particular text field, go back to the NewForm.aspx, right click anywhere in the browser window and click the View Source option. In your source code look for the ID of the  textfield.

      Save the code below and exit edit mode. You should be good to go.

      We love your comments, questions or requests to further extend the code above, so feel free to write to us below.

      Thanks and happy coding 🙂

      MOSS 2007 Post

      CoolWriteups Solved: Remove Side Navbar in SharePoint 2007 web part page.

      Hello

      An easy and quick way to remove the left side navigation bar on a SharePoint 2007 (MOSS 2007) web part page is to simply do the following:

      1. Site Actions > Edit Page;
      2. Add a Content Editor Web Part to any Web Part zone;
      3. Edit the Web Part > Modify Shared Web Part> Source Editor;
      4. In the Source Editor, type the following code
        <style>.ms-navframe{display:none;}</style>
      5. Click Apply to save the changes and you’re done.

      I haven’t tested this out in SharePoint 2010, so if you have then please let us know.

      Thank you and happy coding.

      MOSS 2007 Post

      Application Specific Permission Settings Do Not Grant Local Activation – MOSS 2007

      MOSS 2007 ErrorAfter upgrading your MOSS 2007 environment with the latest service pack you are likely to see this error pop up under Event Viewer > System.

      The full error message is likely to look something like this:

      The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID {61738644-F196-11D0-9953-00C04FD919C1}
      to the user Domain\SPService SID (S-1-5-21-4271965062-2695094486-146864038-2112).  This security permission can be modified using the Component Services administrative tool.

      Solution:

      • Copy the CLSID, in this case, 61738644-F196-11D0-9953-00C04FD919C1;
      • Go to Start > Run > Regedit and ensure that Computer is selected right at the top;
      • Go To Edit > Find and paste the CLSID and hit Find Next;
      • In the right pane, make a note of the title under the Data column for (Default). In this instance it was “IIS WAMREG admin Service”;
      • Then go to Start > Administrative Tools > Component Services and expand the Component Services tree node;
      • Then expand Component Services > My Computer > DCOM Config and search for IIS WAMREG admin Service;
      • Right click it and go to Properties. Hit the Security tab and in the first box – Launch and Activation Permissions – ensure that the Customize radio button is selected and click the Edit button. Add the service account that is needed, in my case it was the SPService account.

      Any questions please just ask by leaving a comment below.

      MOSS 2007 Post

      Alternate Access Mapping (AAM) in MOSS 2007

      I came across quite a few articles on this subject but I decided to do things a little differently to get alternate access mappings (AAM) to work with my MOSS 2007 website.

      Some articles or forum posts will suggest you go to the Operations tab in Central Administration, click on Alternate Acces Mappings and then manually add a new entry. I suggest you don’t do this, instead in order to create a new alternate access mapping such as http:team, I suggest you do the following:

      To get this to work successfully you will need the following:

      • Windows Server 2003 with latest service pack;
      • SQL Server 2005 with latest service pack;
      • MOSS 2007; and
      • Active Directory installed.



      My configuration consists of a single Virtual Machine with Windows Server 2003, SQL Server 2005, MOSS 2007, Active Directory and Visual Studio 2008 installed.


      So let’s proceed with the following steps:

      • In Central Administration, go to Application Management;
      • Click the Create or Extend Web Application link;
      • Click the Extend an existing Web application link;
      • Change your Web Application selection from No selection to your Default Web site;
      • In the IIS Web Site section, ensure the Create a new IIS web site radio button is selected;
      • In the Port textbox enter 80;
      • In the Description, enter your alternate access mapping name. Eg: SharePoint – Team;
      • In the Host Header textbox enter Team;
      • Select either NTLM or Kerberos authentication;
      • In the Load Balanced URL section, ensure your URL is http://team; and
      • Select Intranet in the Zone dropdownlistbox and click OK.



      Once you complete the above configuration, you will need to add a New Host(A) entry to your DNS server. This is how you do it:

      • Go to Start > Administrative Tools > DNS;
      • In the left navigation space, under DNS you will find your main web server, under that click Forward Lookup Zones;
      • Then right click your DNS server name, NOT the _msdcs folder, the one below it and select New Host (A);
      • In the New Host window enter the name for your AAM, in this case Team and enter the IP address of the webserver that hosts the Default Web Site you are mapping to. Leave everything else as default in the New Host window; and
      • Reboot your VM or server.



      Once you’ve completed the alternate access mapping (AAM) configurations above, open up a new browser session and enter http://team/. You should now be able to see your previous default website, which probably had a url like http://servername, open up with the new alternative URL http://team.

      If you are running Firefox, you may be prompted to enter your login name and password which you can turn off by following the instructions in my previous article How To: Disable Login Prompt in MOSS 2007 and SharePoint 2010 in Firefox Browser.

      Good luck.