How do I create relative links for use in a sharepoint site template - sharepoint

We are creating a site template that among other things has a Document library with MANY sub folders and a Link list that contains shortcut links to the depths of the DocLib. While making the Site template we are checking the box to 'Include Content.' We are using Sharepoint 2010. No MOSS.
Our problem: Once we make a site from the template, the shortcut links don't work. While the first part of the link URL is rewritten, there is a portion of the original site name still buried in the URL.
My Question: Is there a way to create a relative links to content inside of the site, so that the the site name isn't included? or is there a variable I can use to represent th current site? or do I have to programmatically 'fix-up' the links after it's created? or some other better option?

There is a way, but you will have to do your work in master pages. The following tag is rendered in a sharepoint 2010 master page as ahref, and the relativity is passed on to sites created as templates.
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/SitePages/dashboard.aspx" id="v3idNavLinkTrackerDash" Text="Now is the time for all good men." />

I think you may have come across one of the many limitations of using templates. I don't know of any way to change this behavior when using templates.
However, you mentioned programming. If you are deploying customizations, you might look into site definitions or feature stapling with code to populate the list.
On the no code side, you might have some options if there is some flexibiility in execution of the site. If you really need the sub folders and the template method, you might look at replacing the link list with a page. If the page content is a list of links, they will be relative. If your structure is flexible, another option is to remove the sub folders. You could add a field for category that you can group by instead. Or, you could create seperate document libraries instead of using folders.

Related

Adding a WebPart to a SharePoint 2013 Master Page

Have looked on here plenty but this is the first time I've asked a question, so please bear with me.
Within my SharePoint site collection, I have a list of links to other systems within the business - this list is hidden to all users apart from Admins. There is a department column, indicating the department each link belongs to. There are two filter columns in this list - one is "active", the other is "show in System Links".
On each departmental page, there is a Content by Query Web Part (CQWP) showing the list, filtering to show:
- Specific departmental links
- Only where active
Separately to this, there is another CQWP on the homepage of the site collection showing all those links that have "show in System Links" ticked.
What this allows me to do is if for some reason a system is offline for maintenance, I can change the "active" value in the list and all links will vanish (preventing users going to the external system). It also allows me to add prominence to a link on the homepage if it's of particular focus that day / week / month (i.e. link to HR system to book leave if there's a leave deadline coming up).
What I want to do is move the homepage System Links CQWP to under the Quick Links on the left hand side, so they appear on every page. I did this with no problems in 2010, by literally dragging and dropping in the visual view for the master page, but seem to be struggling in 2013.
I've tried following the advice here:
http://ramisharepointblog.blogspot.co.uk/2013/01/how-to-add-custom-webpart-within.html
When I add these to the .html master file, I get an error message saying that I need to change the file extension of my HTML file to something else.
I get this message whether I copy and paste the code, or whether I use the button "insert web part". (Obviously doing this in SPD 2013)
When I do this, it seems to lose the reference to the .master file (or explode!)
As an alternative, I tried adding the code into the .master file, but of course I can't do this, as it won't let me move / edit / copy a .master file.
Any help in this would be MUCH appreciated, as I seem to be banging my head against a wall here.
On SharePoint 2013 you can not add the Web Parts to the master page the same way of 2010.
Please use the Design Manager -> Snippet Gallery.
In short:
You must wrap the Register tag with: <!--SPM: register tag -->
Like this:
<!--SPM:<%#Register Tagprefix="Publishing" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
You should wrap the opening tag of your Web Part with: <!--MS: tag -->
And the closing tag with: <!--ME: tag -->
The Web Part would look like this:
<!--MS:<asp:SiteMapDataSource ShowStartingNode="True" SiteMapProvider="SPNavigationProvider" ID="topSiteMap" runat="server" StartingNodeUrl="sid:1002">-->
…
<!--ME:</asp:SiteMapDataSource>-->
(Snippet Gallery will automatically create the tags in the right way and you can copy it to your master page.)
Possibly related to my question, have a look at the detailed answer given here: How to embed SharePoint 2013 webparts directly in aspx layout page as default webparts for that layout
I know this is an old question, but users get encouraged to search, and this is what came up, so I thought I'd help out fellow other users find an answer :P

SharePoint 2010 site templates and list customizations

In SharePoint 2010 I have a list. I modified the default list page (allitemsg.aspx) to show another list, so now in the page I can show a manager and his sub-employees for example.
Now if I save this site as a template and create a new site based on it, this customization does not carry over. The manager list page will only show the managers, and the sub-employees list will be gone.
Is there a way to make a template the preserves this type of customization?
Thanks.
Not really a solution to this direct problem, but if you used related item views they do carry over.

Sharepoint Branding

I'm just tasked by my boss to create a Sharepoint solution for the scenerio below.
(I'm a total newbie to Sharepoint. So please forgive me if i use the terminology wrong)
The portal should open in a custom look than the default Sharepoint design and it should have links to the products. Every product page should have different look and feel but have same types of content. For example every product should have Published Materials list but with different set of content.
So, an example of the desired map is like this:
/Home
-Latest News
-Core Team List
-Products
-Product 1
-Product 2
-Product 3
I found Sharepoint a whole new and strange world. I thought i'm good at learning, until i met Sharepoint. Everything seems very detailed and i'm living difficulties in finding useful information quickly. Because i have no Sharepoint background and i don't event know what i'm lookin' for.
Could you please help me by telling me how can i accomplish this or even just telling me the name of "thing" that i'm trying to accomplish.
Thank you in advance.
PS. Oh, by the way, I learned the word Branding in my search for the holy grail. I don't even know that the word fits or not...
I did try the method you post on other page (Restaurant review site in SharePoint) but unfortunately i couldn't succeed. I stucked at choosing what type of content type in the "Create Content Type" page at first and then tried some parent types but i couldn't get it show up in Sharepoint Designer 2007's New Sharepoint Content "Publishing Page" dialog.
So i tried something else.
At my homepage created a new Document Library of type "Web Part Page" called "Products". It created me a some sort of list whose all items are web pages. At this point i felt that i'm near to accomplish something at last.
Here are some questions i've collected: :)
I add two Announcements web part to different "Products" pages. When I add a new announcement to the list from one product page, it shows up in the other one too! How can I make their content only visible in page that the content created on?
*[Theming is a recurring theme in my posts]* Is it possible to change the view of each Product page at this setup so they have different design and color?
Thanks.
Check out the links I posted in the answer to this question for some links to SharePoint 101 tutorials online:
Restaurant review site in SharePoint
Given you're looking for 'branding' that will mean a custom Master Page. A Master Page is what will determine the overall layout of your SharePoint Web Application's pages. After creating a standard SharePoint application, connect with SharePoint Designer and play with that Master Page for a while until you get the hang of it.
In modifying or creating custom Master Pages, it is important to take note of all the controls (special ASP.NET server-side tags) in particular Content Place Holders; if you create your own Master Page and these are missing you're in a world of uninformative-error-message hurt.
You're going to want to create Lists ( http://office.microsoft.com/en-us/sharepointtechnology/HA011199881033.aspx ) to represent 'News' and 'Products'... for Products you may even want to create a Content Type.
Once you create 'News' and 'Products' lists, to see those lists of Products you'll want to make views and use List View Web Parts ( http://office.microsoft.com/en-us/help/HA100240521033.aspx ) to include those views in Pages... but at the subject of Web Parts this is probably getting a bit overwhelming so I'll stop here. Comment me if you'd like more.
Addendum
"Is is possible to show only categories of a document library in home page and documents of the selected category in another page?"
-> Yes, and there are several ways. I'd suggest you look into either defining a View for that list which filters based on the category field, then add List View Web Parts to your home page, or writing custom XSLT for the Content Query Web Part, and then add it to your home page. Writing the XSLT for he Content Query web part is a little more difficult, but using the List View has it's short comings in being not-as-configurable, much like this guy is finding out: No-code solution for calendar view of SharePoint news items
"But how can i change a list item to show its details as a whole new page with its own web parts and theme?"
-> Here's the kicker; in SharePoint, each Site you create has a special list for Pages, and each Page actually belongs to a Content Type.
So you can take any content type and turn it into a page; all you have to do is create a Page Layout for it, and add that Content Type to the list.
(So, an example. This is purely speculative; I'm not saying do this specifically, and you probably can't do it exactly as I describe it as I'm oversimplifying a little)
You create a Content Type 'Product', but you also decide 'Category' should be a Content Type too. So you create a content type for 'Catagory', and you give it a lookup column, which refers to items in the 'Product' List. You specify that the lookup can contain multiple items.
Now you want a Page where people can see a category, and all the Products which belong to it. You create a 'Page Layout' (an aspx file) for the 'Catagory' Content Type. In the Page Layout aspx file you can include web controls which render the Catagory's fields, such as 'title' and 'description' and you can probably even add one to render the 'Products' lookup field. (maybe you'll have to code it yourself)
I hope I haven't lost you.
Now that you've created a Page Layout for 'Catagory' you can add 'Catagory' to the Pages list/library and then create pages which represent Catagories, and when people edit those pages, they will also edit the Catagory.
More Addendum
If "Announcements" is a list, the web part you added was a list view web part, and so it just shows the contents of the list (which is independent of the product pages)
You'll want o specify filters of your view. I dunno if you can specify unique filters on the web part... but you can try :)
You might want to consider looking into The Content Query Web Part.
I don't fully understand your second question, but I get the feeling the answer is yes... what do you mean by "view"? You gotta be careful with the lingo; do you mean the Page Layout? or the List View Web Part? or the List View? or the Master Page? ...
you HAVE to check out Heather Solomon. She is the shiznat when it comes to sharepoint branding.
A good start would be using Sharepoint Designer.
Use SharePoint Designer to do your CSS work, particularly in discovering the CSS rules in play. DO NOT publish the finished work from SD; if you do, future Windows Updates may wipe out your files. Instead, deploy your customizations as a Feature. In MOSS 2007, you can add a single custom CSS file using Central Admin - this will then be applied AFTER core.CSS at runtime, To the best of my knowledge, this is the only practical way of doing this.
You need to indicate whether you are using WSS or MOSS. With WSS, you can use themes.

Move Sharepoint Wiki between site collections

I've got two sharepoint site collections. Now i have a Wiki in one and i want to move it to te second one. I did the move with creating a template and import it into the new one. The problem í've got now is the links. The Wiki links are refering to the old location.
Does any one a solution for this?
The problem with the SharePoint Wiki system is that it resolves the Wiki style links [[link]] at save time to absolute links to the page in the Wiki page list.
I think you will need to write some code that loops through and updates the text in your Wiki pages. Use the WSS object model to to find and update each list item that represents a Wiki page.
You can also have a look at www.sharepointproducts.com where you can download a free version of a tool (CopyMove for SharePoint) that can also move Wiki pages across site collections. It does, however, not update the links on the Wiki pages. But it is my tool - so I will give it some thought whether to add support for this. It is not the first time I have heard about this problem.

Share Sharepoint lists across sub sites

I've got a situation where I want to have a master list at the top level of a Sharepoint site, and then allow the sub-sites to see the master list. I've tried working with Content Types, and either I'm slow and just can't get the concept, or it doesn't seem to apply.
Anyone have any luck?
It depends on what you mean by "see" the master list.
If you're writing code to access it, you can do that by getting an SPWeb object for the top level site and using its Lists property.
If you just want to display it on a web part page, you can do that with a Content Query Web Part.
If you want to use it in other lists somehow, that's a more involved question. You can definitely set up lookup columns to point to lists in other sites, but we've only done that via custom site and list definitions.
Also, if you want to reuse some text or HTML from your master list and you're using MOSS, the Reusable Content list in the site collection's top site is useful.
I heard some web parts can build relation between lists that are located on different sites. But it is new to seek sharping list relationbetween master-sites and sub-sites.
I am not sure if this relation can be seen as cross-site, if positive then take a look at Sharepoint Cross-site Lookup. Otherwise for me your requirements is an "involved question" .
You can also use data view webparts to serve up list data from other sites.
If you want to be able to have a lookup column, looking in another list at a higher level site. you can at the higher level site create a site column (under site settings) that is a lookup field to the socalled masterlist. Then on the list in a subsite, you can add a site column, then choose the site column you created earlier.

Resources