Tag Info

Hot answers tagged

29

I have resolved the same issue using the my post. In Feature.xml add a reference to the Feature receiver class. <?xml version="1.0" encoding="utf-8"?> <Feature xmlns="http://schemas.microsoft.com/sharepoint/" Id="{35867BDA-82DC-418c-9005-79CCC363E3CD}" Title="blah" Description="blah" Scope="Site" ...


11

I came across this link by Josh Gaffey that describes how to set the welcome page for a publishing site. The code I used is: ... // Create publishing page if (bPageCreated) { using (SPSite site = new SPSite(p_sSubSiteUrl)) { using (SPWeb web = site.OpenWeb()) { PublishingWeb publishingWeb = null; if ...


9

Let me see if I can explain pages in SharePoint without making you even more confused. The difference between the different kind of pages very much depend on whether your view is as developer or as end user. As you're refering to MSDN I'll start with the developer view. SharePoint Pages from a developer point of view From a developer point of view there ...


7

You can do this in code: Set the Welcome Page property of the RootFolder of a web. This property is available in 2007 and 2010 using (SPSite oSiteCollection = new SPSite("http://MyServer/sites/MySubSite")){ using(SPWeb oWebsite = oSiteCollection.OpenWeb()){ SPFolder oFolder = oWebsite.RootFolder; oFolder.WelcomePage = ...


7

As long as you dont customize (unghost) your page layout, updating through declarative feature should work fine. By any chance did you create your page layout in SharePoint designer? If you did, a little known "feature" is that even though you provision your page layouts with GhostableInLibrary they will be unghosted and hence you will only be able to take ...


5

In the most concise terms I can think of - a Page Layout is used to display content, a Master Page governs the look and feel for the whole site. A Page Layout has an associated content type, therefore it stores content, and a page derived from a Page Layout will store the content in the content type's fields. A MasterPage does not have a content type and ...


5

First create your User Control and publish is to SharePoint. Then you register a tag for your control <%@ Register Tagprefix="MyControls" Namespace="KM.MyControls.MyControl" Assembly="KM.MyControls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=<Your token>" %> Then you can reference your User Control <MyControls:MyUserControl ...


5

Add <SharePoint:FieldValue FieldName="Title" runat="server"/> for Page title or <SharePoint:ProjectProperty Property="Title" runat="server" /> for Site title in one of the ContentPlaceHolders in the PageLayout, for the body in the <asp:Content runat="server" ContentPlaceholderID="PlaceHolderMain">


5

You can use the Client Object Model to get a reference to the file and then use the checkOutType property to see if it has been checked out. SP.File.checkOutType property


4

If you place a FieldValue control on a Page Layout you can set this to display the value of a custom column using the FieldName property. For example: <SharePointWebControls:FieldValue FieldName="CustomFieldName" runat="server"/> Note you will need a reference to Microsoft.SharePoint.WebControls at the top of the page before this will work e.g. ...


4

Note: File can have multiple major versions but only one version can be published one! You cannot get published version by using CAML query. To do it by code you need something like this: // item is SPListItem object retrived by CAML query or some other method // there also some other options on how to get SPFile SPFile file = item.File; for (int i = ...


4

You need to update your page layout programmatically. You have two options: Overwrite existing page layout: Updating a SharePoint master page / Page Layout via a solution (WSP) Deploy another page layout and replace all of its usages: Programmatically Update Page Layouts


4

Add a page to the Pages library of your site, name it HomePage.aspx. Add whatever webpart etc. you need to it. Then, in the site settings of the site (_Layouts/AreaWelcomePage.aspx) set the url to point to your custom homepage. Now when someone enters the url of your site (ie. http://mycoolportal.company.local) IIS / SharePoint will point the browser to the ...


4

SharePoint pages already include a #mainContent anchor that you could reuse: <a href="#mainContent">Back to Top</a> I think it is also associated with the accesskey J.


4

When provisioning Publishing Pages, you need to load an instance of the Template Redirection Page (found under SiteTemplates\SPS\default.aspx), but set the Url for the page to the name that you want to create, and set the properties such as content type and page layout in the normal way. Have a look at this for an example: ...


4

You could use PowerShell for this. The most tricky part is checking in/out and approving depending on what type of publishing is enabled, and weather pages are already checked out by others. Check out the stub code below. Included two methods to ensure that checkout and approve is done correctly depending on setup. A couple of things to note: BE AWARE ...


4

Normally, pages created in site/SitePages wont have the Publishing tab because versioning on these Library types are set to "Create major versions" . Major versions do not require Publishing as it creates a new major version when you check-in, save. Pages created in site/Pages will have the publishing because that Library type is set to create "major and ...


4

You can use a standard HTML redirect with a wait period of 0: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Redirecting...</title> <meta http-equiv="REFRESH" content="0;url=http://www.yoururl.com"> </head> <body> </body> </html> Changing the ...


4

It could be achieved with HTTP Redirect in IIS using IIS URL Rewrite module. This module allows to create various rule actions including redirect and request abort. For your scenario i recommend this option because this should redirect the request faster as the redirection happens as soon as the HTTP request received by IIS. Configuration Let's ...


4

SP.File.checkOutType property gets a value that indicates how the file is checked out of a document library Get file checkout type via REST $.ajax({url: "/_api/web/getFileByServerRelativeUrl('" + pageUrl + "')/checkOutType", headers: { "Accept": "application/json; odata=verbose" }, success: function(data) { ...


3

So it really boils down to a few things. First, when you create a Publishing site you will have complete control over the master page and page layout experience. Another words, if your requirement is to build a public facing web site you would want to create a Site Collection based off the Publishing Portal template that is available. You can control page ...


3

If I understood your question correctly you are looking for a way to hide left navigation (Quik launch) on most of site pages and show it just on pages of certain page layout. Important thing here is: What is commonly used scenario (or default scenario): navigation is visible or navigation is hidden? (I am assuming navigation is hidden) The simplest ...


3

To get rid of the HTML you can add a control adapter to your web part zone control. Here is a link to a blog post where this is done.


3

I think you'd need to use "Content Editor Web Parts" if you're pasting in javascript which you intend to have working in a SharePoint page.


3

My first thought was also for a Wiki site. When you get up to 2010 you get some added value in that you can use enterprise tags for the pages and users would also be able to leave notes/comments using the social features if you are using the Server version. The second option and something I did frequently in previous versions of SharePoint was a FAQ list ...


3

Simplest possible code to just get page and folder names is: using(SPSite site = new SPSite("http://myCoolSite")) { using(SPWeb web = site.OpenWeb()) { SPList pageList = web.Lists["MyCoolPageLibrary"]; // Get items foreach(SPListItem item in pageList.Items) { // item.File.Name } // Get ...


3

It should be id="Top" instead of name="Top" It should be rather easy. Insert a HTMLform webpart and insert your <a href="top">Go to top</a>, save it and export the webpart and call it "BackToTopWP". Then you can import it and it should be available for all admins/moderators/whatever to insert.


3

You have to use SiteDataQuery as replied by Thomson above. Here is some sample code SPWeb web = SPContext.Current.Site.RootWeb; SPSiteDataQuery query = new SPSiteDataQuery(); //Server template for page library is 850 query.Lists = "<Lists ServerTemplate='850' Hidden='TRUE' />"; query.ViewFields = @"<FieldRef Name='URL' Nullable='True' ...


3

If you're using SharePoint 2010 you can use List validation: Make sure your Page layouts include "Scheduling Start Date" Go to the Pages library Select List settings in the Library tab of the Ribbon Select Validation Settings Enter a formular like =[Scheduling Start Date]>TODAY() Enter an appropriate user message like "Page must be scheduled into the ...


3

I would suggest the use of native policies (like in our case the expiration policy) that you can attach to a specific content type and trigger an action / workflow when the policy is met. In this case it will be when an item's age is reached. (eg : http://technet.microsoft.com/en-us/library/cc262112%28v=office.12%29.aspx) What I've been doing for a customer ...



Only top voted, non community-wiki answers of a minimum length are eligible