Showing posts with label SharePoint 2013. Show all posts
Showing posts with label SharePoint 2013. Show all posts

Wednesday, August 26, 2015

How to add the note board web part to your page layout

The situation: I'm creating a site with internal news articles, and the customer would like for people to leave comments on each one.

The problem: I tried going into SharePoint Designer and adding the web part through the interface, but then got the "sorry, I don't understand that tag" message.

The solution: It's always a matter of figuring out the proper include for the top of the page, isn't it?  Here's what I did:
  1. Add the note board web part code into the page layout:
    <SharePointPortalControls:SocialCommentWebPart id="noteboard" ChromeType="None" runat="server" />
  2. Add the SharePointPortalControls include to the header of my page layout:
    <%@ Register TagPrefix="SharePointPortalControls" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>

Friday, August 21, 2015

Adding Content Query Web Part to a master page

The situation: I'm trying to create a footer for my site which dynamically displays recent news articles, blog posts, and videos.

The problem: I'm having issues with both the Data View and adding my exported Content Query web part to my master page.  The CQWP is giving me an error message that the WebControls:ContentByQueryWebPart isn't cool, and the Data View is not filtering as I expect, and those stupid column headers are killing me.  I read somewhere that you shouldn't put CQWP on a master page, but I'm going to do it anyway.

The solution: After piecing together several articles (mostly about SharePoint 2010), I was able to make my content query solution work:

  1. Create a test page.  Add a Content Query web part.
  2. Configure it to show what you need.  Give it a useful name and hide the chrome.
  3. Export the web part.  Save it to the site collection web part gallery.
  4. Open the master page in SharePoint Designer.  (This is where I discovered that you have to hit Code View Tools > Parse HTML to be able to add any web part or code view to your page.  Every. Time.)
  5. Add these to the top of the master page:
    <%@Register Tagprefix="Publishing" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
    <%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
  6. Insert tab > Web Part > find your exported CQWP > click on it.
  7. SPD will insert your web part with this tag: <WebControls:ContentByQueryWebPart>.  This is what will create the error on your pages.  I added Publishing before WebControls in the opening & closing tags: <PublishingWebControls:ContentByQueryWebPart>.  All better.
  8. Save. Publish.

Wednesday, August 12, 2015

Making the SharePoint blog full width

The situation: I have a team site template with the publishing feature activated.  It has a custom design, which includes master page & page layouts.  It has to include a blog.

The problem: After creating the blog, I realized that the content of the page only goes about two-thirds of the way across, with no way to update that while editing the page.



The solution: After a little poking around, I found the three styles that had to be updated to extend the blog posts to expand the full width of the page.

I added the following styles to my COREV15.css:

.ms-blog-MainArea {max-width:none;}
.ms-blog-postList {max-width:none;}
.ms-blog-MainArea>tbody>tr>td{width:100%;}

The two max-width styles were already listed, with a setting of 860px and 670px, respectively.  I found those and replaced them with none instead of adding a second style.

I'm sure there are different and possibly better ways to do this, but it took care of what I needed.  The end result: