How can I create a custom feature, which will automatically take a custom master page while creating a site ?

Hello ,
I am new in Sharepoint development . I am trying to create a Sharepoint feature to Activate master page automatically while creating the site .Below mentioned code I am using to do this . 
But When I am creating any site under site collection .It is not applying automatically . I have to manually Activate that feature . 
SPSite site = properties.Feature.Parent as SPSite;
SPWeb rootWeb = site.RootWeb;
Uri masterUri = new Uri(rootWeb.Url + "/_catalogs/masterpage/mycustom.master");
rootWeb.MasterUrl = masterUri.AbsolutePath;
rootWeb.CustomMasterUrl = masterUri.AbsolutePath;
rootWeb.Update();
How Can I create a feature that can activate the master page at same time of site creation under Site collection ,Without any manual work .. 
Thanks in Advance .. 

Hi,
You can associate master page during feature activation as follows:
http://social.technet.microsoft.com/wiki/contents/articles/19933.sharepoint-2010-set-a-custom-master-page-during-feature-activation.aspx
Then, you can use feature stapling to apply automatically on site creation:
http://blogs.msdn.com/b/kunal_mukherjee/archive/2011/01/11/feature-stapling-in-sharepoint-2010.aspx
Thanks,
Avni Bhatt

Similar Messages

  • How can I disable the system feature which automatically restarts applications i had open during a previous session ?

    How can I disable the system feature which automatically restarts applications i had open during a previous session ?

    When you log out, uncheck the box to reopen applications. If you're still using 10.7.3, then you will have to uncheck the back with each shutdown or restart.
    10.7.4 update was suppose to fix it that when you uncheck the box, it should remain unchecked for restarts after that.
    For the resume features, check this link:
    http://reviews.cnet.com/8301-13727_7-20083707-263/managing-mac-os-x-lions-applic ation-resume-feature/?tag=mncol;title

  • How do I use Edge Animate to make a clickable image which can be used in Author, and which will redirect you to a different page in your ebook?

    If anyone has experience with Edge Animate, I know that I can make an image clickable, and I can insert a url to define where it will go once clicked. But I want to make a widget to use in iBooks Author, that can take the reader to a certain page of the book. Is this possible?
    It all seems very complicated. Make one thing in Edge Animate, then somehow have that reference something in Author, which will finally work in an ebook. I have no clue where to begin.

    Sort of. I'm using this code inside an action for a button symbol. But it doesn't work perfectly. Trying to debug it.
    Let me know if you have any luck.
    //Check to see if pageCounter already exists
    if (typeof EC.pageCounter === 'undefined') {
      // it doesn't exist so initialize it to first page
        EC.pageCounter = 2;
    //check if the page is only 1 digit -- patch for single digit
    if (EC.pageCounter < 9) {
       // it is, so we need to pad a 0 on the front.
      EC.pageCounterString = "0" + EC.pageCounter;
      //e.g.  01 ...09,11,12,13....115,222352,,....
    else {
      EC.pageCounterString = EC.pageCounter;
    EC.loadComposition(EC.pageCounterString + "/publish/web/" + EC.pageCounterString + ".html", sym.$("container"));
    EC.pageCounter = EC.pageCounter + 1;
    //TODO for back  -1

  • How can I run the C program which will interact with user

    hi, all
    I wanna run a C program whose function is that just show a line of characters, waiting for user input and finally show what user has entered. The C can run correctly in command window. But when I use Runtime class, it can not run correctly. My question is that how I can emulate that C program just by invoking Java method. The code I have written below, thank.
          String command = "cmd /c a.exe";  // a.exe is that C program
          String s;
          try {
             Process process = Runtime.getRuntime().exec(command);
             InputStream input = process.getInputStream();
             BufferedReader bufferedReader =
                new BufferedReader(new InputStreamReader(input));
             while((s = bufferedReader.readLine()) != null)
                  System.out.println(s);
          catch(IOException e) {
             System.err.println("IOException: " + e.getMessage());
          }

    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Process.html#getOutputStream()

  • How can I get a webpage to load dialogs after mistakenly clicking "prevent this page from creating additional dialogs"?

    I still need to be able to have dialogs load with the webpage. I am not able to see any images on this webpage since clicking this button by mistake. Clearing the cache does not address the problem; Re-creating my profile does not correct the problem. Firefox needs to address this issue as it is happening to too many web apps.

    If the slide show is the part not working, I believe that is a Flash slide show. There are some compatibility issues between the latest Flash player and some Firefox add-ons or settings. Could you see whether anything in this article helps: [[Flash 11.3 doesn't load video in Firefox]].

  • Hi I use Osx 10.9.4 and FCPX 10.1.2  How can I choose a CD format which will be playable outside the World of Apple? i.e. in a 10 year old CD player in my old car

    I am trying to make a CD for a Children's Hospital where I used imported tunes from iTunes into FCPX, then sharing and burning in .AIFF or .WAV extensions for the CD.  When I do this I can play the CD on any Apple machine but not in a non Apple Device such as in a CD player in the Hospital, or my car.  I would like to be able to play the CD outside the Apple domain. Any Ideas?  Your suggestions would be most helpful.  Thank you
    DBC
    PS
    I use an iMac OXS 10.9.4 and FCPX 10.1.2

    YYou should do this in iTunes not in FCP.

  • How can we change the purchasing group which it is maintained in R/3?

    Hello All.
    In case of MM, purchasing group is assigned to material master.
    It means purchasing group is maintained based on material code.
    But SRM has different maintenance level.
    As you know that purchasing group has the responsibility based on material group (Product category).
    So we should change the purchasing group from R/3, when end user create shopping cart.
    How can we change the purchasing group which it is maintained in material master?
    Thank you,
    Best regards,
    SH.

    Hello So Hee,
    I am not a technical guy.
    But for your requirement i am building a logic.
    I am not sure whether it will work.
    You need to check with your ABAPER.
    It is as below:
    When the SC is approved and the other configuration is correct ,
    PR is created in ECC by the virtue of BAPI.
    You want that the pur grp should be populated on the base of matl code and not on matl grp.
    Hence in SC you will not fill up pur grp.
    In the programme for BBPSC01 i.e. SC creation you will add modification that it will call a custom FM.
    This custom FM will get the matl code from SC and will find the value of pur grp from R/3 MM01i.e. matl master(you may get in MARA).
    Now in the BAPI you need to incorporate this additional value of yr pur grp field.
    So the desired pur grp as per yr R/3 matl master will be populated in yr R/3 PR.
    Again: this is all hypothesis.
    That's all I can help you.
    BR
    Dinesh
    <b>Reward if helps</b>

  • I have created a spreadsheet on numbers for ipad with a list of customers as a drop down menu. How can i make their address appear underneath when i select the customer?

    I have created a spreadsheet on numbers for ipad with a list of customers as a drop down menu. How can i make their address appear underneath when I select the customer?
    iselect the customer?

    Hi bazza,
    We won't be able to put the address from a formula into the same cell that you enter the customer's name. We can put the address in the cell under the customers name.
    First let's take James advice and concatenate the address in the address table.
    Here is the formula in G2
    =CONCATENATE(B2&"
    ",C2&"
    ",D2&"
    ",E2)
    It shows this way because after I clicked on B2 and typed [&"] (no brackets) I typed option-return
    This gives you your new line. Then I typed the closing ". I repeated this for the rest of the address.
    Next we want to bring this to your order sheet. I prefer using the two formulas OFFSET and MATCH instead of VLOOKUP.
    base tells OFFSETwhere to start counting from. Click A1.
    row-offset is for the row. we will use MATCH() -1 to give us the row.
    What MATCH does is give you the row number where something is found and you can specify an exact match. I usually construct the MATCH formula first and then cut and paste it into OFFSET. MATCH looks like this: MATCH(A2,Table 1::A,0). A2 is what we are looking for, Table 1A::A is where we are looking (the entire column A), and 0 means we want an exact match. Can you see it inside the OFFSET formula? Notice that we had to subtract 1 from its result.
    column-offset tells OFFSET which column A=0 so we want 6.
    we ignore "rows", "colomns" we don't need them.
    If this seems like too much, just break it down into small pieces.
    quinn

  • I have create many free acounts for apple I have reached the limit of creating free acounts how can I delete that free acounts which I have made?

    I have create many free acounts for apple I have reached the limit of creating free acounts how can I delete that free acounts which I have made?

    iOS devices can only create 3 free iCloud accounts, Get a new iOS device
    why would you need more than 3 iCloud accounts for 1 device o.O

  • How can i remove the shuffle feature from my nano?

    How can I remove the shuffle feature from my nano?  I apparently "shook" it and now it is on shuffle.  I can go to settings and remove the shake feature but I can't seem to restore my playing options to a generic loop instead of the shuffle.  Help!

    chelseafromco:  I had the same problem and had an awful time before finding a clear explanation of the solution.  Forget the iPod nano 6Gen manual, p. 21; it doesn't tell you how to turn the feature off, just how to turn it on.  Not all of us like randomizing our playlists.  APPLE:  PUT UP AN ARTICLE EXPLAINING SIMPLY HOW TO DO THIS.  Meanwhile, here's what worked for me:
    1.  Go to the "Now Playing" icon and tap the "Play" arrow in the center.
    2.  On the touch screen that comes up (you'll see an eighth-note graphic with the song title superimposed at the top, a Play/Pause button in the middle, and "Reverse" and "Forward" buttons on either side of that), swipe your finger to the left (not to the right).
    3.  This touch screen will have a "Repeat" symbol with two arrows like a snake eating its tail on the left and another symbol on the right that shows two arrows pointing to the right.  This is the "Shuffle" symbol.  Touch the Shuffle symbol so it's white, not blue.  White means that Shuffle is  off.
    4.  To make sure you won't accidentally turn Shuffle on, which you can do by giving the iPod a shake, go to the main Settings icon, cick it and select "Music," then press "Shake to Shuffle" until the button next to it says "Off" (white, not blue).
    Hope this helps.  By the way, in case you were wondering:  The whirling-molecule symbol in the center of the "Now Playing" controls is the Apple "Genius" symbol. This is to remind us that Apple's  manuals are created by people who don't know that customers need  instructions on how to turn things off as well as how to turn them on.

  • How can i add STORAGE LOCATION field which is not...............

    hi,
    sap gurus,
    good morning to all,
    how can i add STORAGE LOCATION field which is not in the standard tables namely
    KOMP, KOMK, and KOMG.
    how to include it in our FIELDS FROM FIELD CATALOGUE.
    if we include this field is there any impact on the standard tables.
    plz let me know this.
    bcz
    we are selling our products in two ways
    (1). one is straight from factory ie direct sales from factory
    if customer asks for excise invoice then we will sell thru factory and keeping freight in mind we will
    deliver him which ever is economical either rail or road.
    before coming to second case of selling the goods
    we will do STOCK TRANSPORT ORDER from plant to different storage locations.
    if we did STO thru road we have to sell the goods thru road only.
    if we did STO thru rail we have to sell the goods thru rail route only.
    (2). if the customer is not asking any excise invoice then we will send the goods thru depo/storage
    location which is not registered under excise.
    if the goods came by road then it will be delivered by road only.
    if the goods came by rail then it will be delivered by rail only.
    my logic here is
    basing on the
    storage location, transportation types, and distance i want to create condition record
    that captures exact frieght at the sales order level.
    confirm whether i am right or wrong.
    regards,
    balaji.t
    09990019711.

    Hi,
    It is not recommended to add new fields to any SAP standard tables. It disturbs the whole SAP functionality.
    But if you have no choice expcept to change the standard tables to meet your requirement -  then you need an access key to modify the object, which is available from the market place.
    Nevertheless, the better option is to create a 'Z' table with the required fields and use that accordingly.
    Changing standard tables will have serious impact when you apply patches or do an upgrade on the existing functionality.
    REWARD POINTS IF HELPFUL
    Regards
    Sai

  • How can we capitalize the PR/PO, which are already booked in cost center?

    We are creating a capital Project for our department.  We have the structures ready and finalized with the budgets. But, the department has already done some commitments and expenditures in their cost center .Now, this expenditure and commitment values needs to be reflected in the report, so that correct values of assigned and available should be updated.
    1) Pls. suggest a process using which we can transfer this amount. Is this to be done by an FI entry or else we need to commit using sanction request?
    2) How can we capitalize the PR/PO, which are already booked in cost center?

    Hi,
    As we know the Contract is an Outline agreement for Quantity or Value for a particular Period with vendor.
    Without mentioning Plant also we can make contract for the Purchase organisation level for particular Material for the entire period
    Where as while creating PR  -it is an Indent for the material requiement for the specific Plant so when you refer Agreement inthe PR creation time System will ask you how much quantity to what plant you want to place indent. where as In PO  it ia an legal document so when you refer Agreement it will take all the details from Contract
    i think you are clear with my points
    With regrads
    Shrinivas gangoor
    Edited by: Shrinivas Gangoor on May 22, 2009 2:53 PM
    Edited by: Shrinivas Gangoor on May 22, 2009 2:54 PM

  • HT204394 How can I expunge my iCloud account which has become contaminated and open a new one?

    How can I expunge my iCloud account which has become contaminated and open a new one?

    If you want to create a new iCloud account, go to Settings>iCloud, tap Delete Account, then sign back in with a different Apple ID to create the new account.  If you have any photo stream photos that you want to keep, save them to your camera roll before deleting the account.

  • How to create a user  y which will have the same content of existing user x

    how to create a user y which will have the same content of existing user x ,
    like all the tables,procedures,functions and packages

    You can do the following.
    1. Use CREATE USER to create the new account/schema
    2. Use exp to export old schema
    3 Use imp with fromuser=<old user> and touser=<newuser>

  • I am new to IPAD and I want o use facetime, how can I use it to communicate with my mac at home, do I need to create another account with a different email account

    I am new to IPAD and I want o use facetime, how can I use it to communicate with my mac at home, do I need to create another account with a different email account

    do I need to create another account with a different email account
    Yes, the email addresses need to be unique to each device. You may use the same Apple ID on each device, but the email address used by each device needs to be different.

Maybe you are looking for

  • To change the receiver port name

    Hi , I am doing  a File to IDOC scenario. We have a requirement to post IDOC flat file to the IDOC in SAP system through PI. We have Partner Number in control record which we receive in the flat file and that has to be sent to the SAP system which we

  • Sql substitution

    Hi, I have a query like this: select company, productfamily, sum(fy_quota), sum(ytd_orders), max(order_perf) from view_order_test where lower(region) like lower(:P66_REGION || '%') group by company, productfamily now I need some help on how to substi

  • Pages freezes up when opening

    I'm using an older version of Pages (4.3) and an older OS X (10.7.5), but this has been happening sporadically for a while. Usually, a restart has corrected the problem but not this week. When I open Pages, all the windows I left open last time are o

  • Can we do with a 16 pin terminal base for fp-tc-120?

    i got a thermocouple module for my project. The terminal base contains only 16 pins. Is there ne solution for this or shud we get a 32 pin terminal base ?

  • How does Toplink know which Pool to use ?

    We have two pools defined in sessions.xml as below default has is-read-connection-pool false and one with true. We are not specifying to use read pool or default pool in our app anywhere, which we can while acquireClientSession("pool name"), but we a