only My site
Showing posts with label SharePoint. Show all posts
Showing posts with label SharePoint. Show all posts

Wednesday, July 17, 2013

Unable to find a Configuration whose ID

Error

Error occurred in deployment step 'Add Solution': Unable to find a Configuration whose ID is equal to 1 in the WebTemplatePackage_Feature1\Bala Template\onet.xml file for feature {7e557079-c818-415d-850b-c6445896ff96}. The WebTemplatePackage_Feature1\Bala Template\onet.xml file must contain a Configuration element whose ID attribute is equal to the BaseConfigurationID attribute declared in the WebTemplate element.

Cause

The IDs in Element.xml and Onet.xml didn't match.

Solution

The IDs in Element.xml (baseconfigurationID) and Onet.xml(ID) should be the same. Refer the below sample code.

 

Tuesday, July 9, 2013

STSADM Environment Variable SharePoint 2007 and 2010

Instead of navigating to the bin directory in the 12 hive, you can access stsadm.exe from any directory by adding an environment variable:
  1. Start -> All Programs -> Control Panel -> System
  2. On the Advanced tab, click the Environment Variables button.
  3. Select the variable Path and click the Edit button.
  4. Add the following to the end of the Variable value field:
    ;C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN
  5. Click OK.

Note: for 2010, add this instead:
;C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN

Source : http://sharepointcherie.blogspot.in/2009/09/stsadm-environment-variable-sharepoint.html

Wednesday, June 26, 2013

SharePoint 2010 farm topologies

Testing and Verifying SP2010 after software Installation and configuration


Even though you are ready to head out the door and head home since you are probably doing this on a night or weekend, it is really important to fight the urge to leave too soon. You really need to do some basic testing and verification before you leave. It will be a lot better to find out about any problems now rather than when the next business day has already started.
Here is what I recommend doing before you leave:
  1. Browse to each of your SharePoint web applications and log in with your user account and make sure you can hit the home page of each of them.
  2. While you are there, try to open up and edit a document in the browser using one of the Office 2010 Web Apps (Word, PowerPoint, Excel or OneNote).
  3. Browse to your My Site and verify that everything is working normally.
  4. Add a unique phrase to a test page somewhere in one of your Sites (I always use the phrase “jabborwocky” Smile) and then go run an incremental Search crawl from Central Administration. After the crawl completes, go back to your Site Collection and search for the phrase. Verify that it comes up in the results.
  5. Run an incremental User Profile Synchronization from the User Profile Administration page. While it is running, logon to the desktop of the new Application Server, and find this program and run it: c:\program files\microsoft office servers\14.0\synchronization service\uishell\miisclient.exe. This is the Forefront Identity Management (FIM) client application that you can use to see the details of the AD synchronization process. Several jobs will be run by FIM. Verify that they all complete successfully with no error messages.
  6. In Central Administration, go into Manage Service Applications and click on Managed Metadata Service and select Manage in the ribbon. Verify that the Term Store management interface loads and that you can add/change/delete a Term Set and some Terms.
  7. Finally, reboot your WFE and Application Server. When they come back up, check your Windows System and Application event logs on those servers and verify that there are no SharePoint-related critical or warning events that you haven’t seen before you scaled out to three tiers.
  8. Browse to your primary web application one more time before you head out the door.
Source : http://sharepointsolutions.com/sharepoint-help/blog/2011/02/how-to-scale-out-a-sharepoint-2010-farm-from-two-tier-to-three-tier-by-adding-a-dedicated-application-server/

Tuesday, June 4, 2013

Apply Theme for Publishing site


public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
   ApplyTheme(properties);
}
/// <summary>
/// Sets master page and css properties for the site collection
/// </summary>
/// <param name="properties"></param>
private void ApplyTheme(SPFeatureReceiverProperties properties)
{
SPSite site = (SPSite)properties.Feature.Parent;
if (site != null)
{
// System Master Page
Uri masterUri = new Uri(site.RootWeb.Url + "/_catalogs/masterpage/v4.master");
site.RootWeb.MasterUrl = masterUri.AbsolutePath;
// Publishing Master Page
Uri customMasterUri = new Uri(site.RootWeb.Url + "/_catalogs/masterpage/mycustom.master");
site.RootWeb.CustomMasterUrl = customMasterUri.AbsolutePath;
//logo and css
site.RootWeb.SiteLogoUrl = "/_layouts/MyProjectName/Images/mycustomlogo.jpg";
site.RootWeb.AlternateCssUrl = "/Style Library/MyProjectName/css/mycustomcss.css";
site.RootWeb.Update();
}
}

Wednesday, May 29, 2013

SPWebApplication.Lookup Method

Finds the Web application that is located in the specified path.

static void Main(string[] args)
{
     SPWebApplication app = SPWebApplication.Lookup(new Uri("http://spdev2010:1000"));
}

Saturday, May 25, 2013

SharePoint 2010 - SPMetal and Multi list view using Visual webpart



SPMetal.exe resides in "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN" folder.

Example

SPMetal.exe /web:http://YOURSITE /code:SiteEntities.cs 

Friday, May 24, 2013

Sharepoint 2010 Content Type Hub - Publish and subscribe

SharePoint 2010 now introduces a new feature called Content Type Hubs.Content Type Hub is a central location where you can manage and publish your content types – so now web applications can subscribe to this hub and pull down the published content types from the hub. Even receive updates on the published content types!

Some of the useful links are

http://www.sharepoint4developers.net/en-nz/post/sharepoint-2010-content-type-hub.aspx
http://chakkaradeep.com/index.php/sharepoint-2010-content-type-hubs-publish-and-subscribe-to-content-types/
http://blogs.msdn.com/b/chaks/archive/2011/09/04/web-templates-and-content-type-publishing.aspx


Wednesday, March 20, 2013

Master Page : MasterPageFile property & 4 Tokens

In SharePoint, this MasterPageFile property is used differently. It may be or may be not the location of the master page file in SharePoint. In SharePoint MasterPageFile can take four predefined values (called tokens). Based on the token values, SharePoint determines which master page to use for the page (default, custom, site collection, etc). The four tokens fall into two categories: dynamic and static. Static token is used by itself to define the master page location. The two static tokens are described below:
  • Token "~site/MasterPageName.master"
In this token, the ~site refers to site relative URL and MasterPageName.master is the name of the master page. So if you provide the token “~site/masterpages/MyMaster.master” and your site URL is like http://sitecollection/site1 then the master page URL will be http://sitecollection/site1/masterpages/MyMaster.master.
  • Token "~sitecollection/MasterPageName.master"
Here the token ~sitecollection points to the site collection URL. So if your site collection URL is http://sitecolleciton then the master page location will be http://sitecolection/MasterPageName.master.
Dynamic token doesn’t provide the master page location rather it points where to get the master page file location. Dynamic tokens are exact values and you can’t change them like static token. The two dynamic token are described below:
  1. Token "~masterurl/default.master"
When you’ll set the value like Page.MasterPageFile= "~masterurl/default.master", SharePoint will use the master page provided in SPWeb.MasterUrl property. So if you set master page file to this token, you need to ensure that you have provided the master page location to SPWeb.MasterUrl property. FYI, the dynamic token is not changeable and you need to provide exact “~masterurl/default.master”.
  • Token "~masterurl/custom.master"
When you will use this token, then SharePoint will use SPWeb.CustomMasterPageUrl property. So along with setting this token, you also need to set the SPWeb.CustomMasterPageUrl property. FYI, the dynamic token is not changeable and you need to provide exact “~masterurl/default.master”.
 
Souce:Article to change the master page dynamically using HTTPmodules

http://www.codeproject.com/Articles/43377/SharePoint-Dynamically-Change-Master-Page

public class DynamicMasterPageModule : IHttpModule
{


    public void Init(HttpApplication context)
    {
        context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute);
    }
   

     void context_PreRequestHandlerExecute(object sender, EventArgs e)
    {
        Page page = HttpContext.Current.CurrentHandler as Page;
        if (page != null)
        {
            page.PreInit += new EventHandler(page_PreInit);
        }
    }
   

    void page_PreInit(object sender, EventArgs e)
    {

         if (CurrentUser.UserType == UserType.Admin)
        {
            MasterPageFile = "~/MasterPages/AdminMaster.master";
        }
        else if (CurrentUser.UserType == UserType.NormalAuthenitcated)
        {
            MasterPageFile = "~/MasterPages/NormalAuthenticatedMaster.master";
        }
        else
        {
            MasterPageFile = "~/MasterPages/AnonymouskMaster.master";
        }

    }
}