Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've done a fair amount of looking into this idea without promising leads.

Let me define my problem:

I need to add a third column (as a Web Part Zone) to the "My Newsfeed" page in My Sites. The problem is SharePoint Designer will not be available (which comprises 90%+ of the solutions I've found for this problem) and I do not have access to the master page... which limits me to say the least.

Here's what I've dug up so far:

Now, it appears that in order for the page to persist the web part zone I can't just add it willy-nilly ( Using C# ) and it must be added before the PreInit() event in the page cycle (if added programmatically) on every request ( Addressing Page Cycle ) and the recommended method is by altering the code on the page to include an additional asp:ContentPlaceHolder tag ( hence all, the SharePoint, Designer solutions ).

So finally:

I'd like to do this via PowerShell once if possible (a la this link was trying to do-ish). Does anyone have suggestions on this?

share|improve this question
    
"The problem is SharePoint Designer will not be available"... Will you ask to a butcher to work without a knife? No ? Even if everything that SPD does can also be done with C# or PS, do a flavor for yourself, works with the tools than can help you, or explain your customer why it's foolish. But maybe I don't have to whole picture. –  Steve B Apr 27 '12 at 13:01
1  
Yeah, this is a complicated business situation involving our company and another both being contracted for separate pieces of the project. And the final branding solution is basically a massive lock down of SharePoint to prevent the users from being able to mess with things... to the point that I had to write a custom web part for them to even do site provisioning and they are limited to one template, and one location for it to be created. It's a bank. What can you say. –  RJ Cuthbertson Apr 27 '12 at 13:08

4 Answers 4

up vote 2 down vote accepted
+100

If another company is creating those pages, and your client needs /asks you to put in that extra column, have them ask the other comnpany to add that extra column (and perhaps some javascript to hide it if it does not contain any webparts)?

Update:

Ok, the following worked for me:

  • Get a copy of the out of the box default.aspx for the My Site Host site template, found in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\SiteTemplates\SPSMSITEHOST and save it somewhere on disk so you can edit it.
  • Open the file, (don't scream, but the HTML is a complete disaster :-D, I cleaned it up)
  • (After cleaning up the HTML,) add the needed extra column in the tr with id MiddleRow, copy the html from 1 of the other columns already there, give the new zone a unique ID and change the width of the 3 TD's containing the zones:

    <td style="padding:10px">&nbsp;</td>
      <td valign="top" ID="MiddleOuterRightCell" width="25%"> 
        <WebPartPages:WebPartZone runat="server" FrameType="TitleBarOnly" AllowPersonalization="true" ID="MiddleOuterRightZone" Title="Outer right zone" Orientation="Vertical">
           <ZoneTemplate></ZoneTemplate>
         </WebPartPages:WebPartZone>
         &nbsp;
     </td>
    <td style="padding:10px">&nbsp;</td>
    

Now for the actual file overwrite (I did this in a small console app, but of course you can use for instance a FeatureReceiver, or PowerShell):

using (var site = new SPSite("http://mysitehosturl"))
{
  var file = site.RootWeb.RootFolder.Files["default.aspx"];
  file.CheckOut();

  var newFile = File.OpenRead(@"d:\test\default.aspx"); // change path
  file.SaveBinary(newFile);
  file.CheckIn("overwrite with new layout");
}

Clean default.aspx: http://www.dcubed.nl/MySiteHostDefaultAspxClean.zip

share|improve this answer
    
This isn't a bad idea if we had access to the masters. I'm looking for a solution that doesn't involve the master pages. –  RJ Cuthbertson May 4 '12 at 19:29
    
OK, fired up my dev server and did some checking. The page you are referring to is actually not part of your "own" MySite. It is the homepage for the My Site Host webapp. The webpart zones on it are an actual part of that file (default.aspx) and not some master page. So it is overwritable using code (in for instance a feature receiver, or powershell). Working on an example now –  Colin May 4 '12 at 21:28
    
I was concerned that overwriting the default.aspx would make the changes to the My Profile page as well, since they use the same template (shareesblog.com/?p=601) but My Profile uses Person.aspx. This is the best answer thus far, but I was looking for a way to add the zone via the Object Model rather than via HTML. This method is subject to the same problem that C. Marius mentioned about Microsoft Updates. You might end up with the points anyhow though. –  RJ Cuthbertson May 7 '12 at 14:28
    
The fill will not be overwritten by updates, it will be ghosted in the database. –  Colin May 7 '12 at 16:31
    
Thanks for the info. –  RJ Cuthbertson May 7 '12 at 17:23

Good Solution: Make neogitation for business users to allow changes and use another (3 columns) master page for this. This is SharePoint default mechanism for achieving this

Possible workaround: Use custom HttpModule and dynamicaly redirect users to the new master page with additional column. Example

share|improve this answer
1  
Thanks for the input, but we don't have access to the master page. The master pages / branding are being done by another company. We are just doing the build out and custom web parts. Honestly, my best bet might just be to contact the other company and request that they add this column. –  RJ Cuthbertson Apr 27 '12 at 13:55
    
Another possibly technical solution is still use HttpModule and change the page structure before it will init.. However you approach is more legit –  AlexSSE Apr 27 '12 at 14:09
    
If smn downvote, can you plas make a comment at least.. –  AlexSSE May 3 '12 at 7:45
    
The problem with this is it still uses a master. And we still don't have access to these / are not responsible for branding. Also: your link says "Instead, an HttpModule must be configured as an all-or-nothing proposition at the Web application level." This is only on one page (My Newsfeed) of the web application and not the other two (My Content, My Profile). –  RJ Cuthbertson May 4 '12 at 19:28
    
@rjcup3 Thanks fow clarifications. But still in HttpModule if you know the exact URL you can process only these requests. –  AlexSSE May 5 '12 at 10:57

One option would be to make a copy of the physical file in the 14-hive from any SharePoint installation, adapt it in your solution and REPLACE the original via a solution package deployment. The obvious downside is that product updates might overwrite it!

share|improve this answer
    
It's for the My Newsfeed which uses the same definition as My Profile. One has a third column, the other doesn't. –  RJ Cuthbertson May 4 '12 at 19:24
    
Plus, as you noted product updates may overwrite this. –  RJ Cuthbertson May 4 '12 at 19:24
    
yes, but what i mean is copying its source, change in the design time to add necessary changes, keep it to inherit from the same Application page base, but give it a new file name. Once this is done, change the Top navigation bar via Site Settings to point to the NEW one. Because this is shared across all my sites it will be targeted everywhere! –  C. Marius - MVP May 5 '12 at 8:51

If you need to customize 14 Hives pages you can replicate the 14 hives dir and point your vdir to that 14 hives dir. Remember to backup files prior to patching. This is supported by Microsoft.

Ditto: http://sharepoint.stackexchange.com/a/35483/3569

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.