You are on page 1of 9

Link to top level of a site collection Using SPUrl

Recently I was coding a branding package that deployed several master pages, image files and css files. The package was scoped to the site collection level, of course. In addition to the top level site collection, there were multiple site collections located in various managed paths. I made sure my package deployed the relevant files to the root of each site collection in the Style Library and master page gallery. The next step was to make sure that the master pages were properly referencing the files in that site collection, and not in the root site collection. A link such as shown below will not work. It will point to the Style Library at the root site collection, not necessarily to the Style Library where the feature is being installed. <div class="interiorHeaderLogo"><a href="/"><img src="/Style Library/InteriorPageBrandingPackageAssets/images/interiorTopBar.png" border="0" style="background-position:left top"></a></div> Many blogs correctly pointed out that I needed to use SPUrl and reference the site collection. The problem was getting the syntax right. Most examples I found were relatively simple and were focused on simple links. I was dealing with a clickable image, which is a little more involved. Incorrect syntax will throw an error similar to: Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Literal expressions like '<% $SPUrl:~SiteCollection/%>' are not allowed. Use <asp:Literal runat="server" Text="<%$SPUrl:~SiteCollection/%>" /> instead.

The proper form for the link above is: <div class="interiorHeaderLogo"> <asp:Literal runat="server" text="<a href=&quot;/&quot;> <img src=&quot;"/> <asp:Literal runat="server" text="<% $SPUrl:~sitecollection/Style Library/InteriorPageBrandingPackageAssets/images/interiorTopBar.png%>"></asp:Literal> <asp:Literal runat="server" text="&quot;/&gt;&lt;/a&gt;"/> </div>

This will reference the image in the Style Library in the site collection the feature is being installed to, will eliminate the parser error and will properly display a clickable image in your branding package.

Posted by BamaTrapper at 2:52 PM Email ThisBlogThis!Share to TwitterShare to Facebook Labels: Branding, Master Page, Parser Error, SharePoint 2010, SPURL

2 comments:

1. Syed Shoaib AdilFebruary 20, 2013 at 3:57 AM It solved my problem for all the site, but when i am clicking ADD NEW ITEM link, which is supposed to open InFoPath form, i m getting the exception again. From ULS i found it was same The Controls collection cannot be modified because the control contains code blocks (i.e. <% html ... %>). tag >

i have used asp:literal as following HTML in LI < li <asp:Literal runat="server" text="<a href="" /><asp:Literal runat="server" text="<% $SPUrl:~site/%>"/><asp:Literal runat="server" text=""/>Home</a>"/> </li> Reply

2. KB2007July 15, 2013 at 9:35 PM Hi, I am trying to use the same for displaying logo in master page. However, COntrol register do not it in SPD it is giving me parsing error

Error The Do Also Please Krutika Reply

expression

prefix

SPUrl i am you

was

not

Creating recognized. need use provide

Please

correct

the

prefix

or

the

prefix

in

the

section

of

:asp:literal configuration. ? path. helpful.

when if

trying can

to

to SPUrl:~sitecollection some

it

is

working will

anything for the be

managed really

guidance

Test Practice

Welcome Mr Cherukuri Venkateswarlu |

Home

Learn MOSS

MOSS Admin

Interview Questions

Issues

Comments

Site Actions

SharePoint Issues

Edit | View All Site Content

Add | History

When I try to create a new site, I get a

SharePoint Home Bad Request 400 SharePoint Issues Babu Configuration Error

message that the site is already in use or already exists


Symptom
When you try to create a new site collection, you may see the following message:

Another site already exists at http://sitename/sites/subsitename. Delete this site before attempting to create a new site with the same URL, choose a new URL, or create a new inclusion at the path you originally specified.

When you try to create a new subsite, you may see the following message:

The Web site address /sites/subsitename/subsubsitename is already in use.

Resolution
The URL of the Web site that you are trying to create already exists in the same site location. Click the Back button in your browser, and then type a different URL for your site.

When I try to create a new list or library, I get a message that the specified name is already in use
Symptom
When you try to create a new list or library, you may see the following message:

The specified name is already in use. A list, survey, discussion board, or document library cannot have the same name as another list, survey, discussion board, or document library in this Web site. Use your browser's Back button, and type a new name.

Resolution
You cannot create a new list or library that has the same name as an existing list or library. Either type a different name for the new list or library, or delete the old list or library before you create the new one.

NOTE

If you receive this message but you are unable to locate the existing list or

library with the same name, you may not have sufficient permission to view the list or library. Contact your administrator for assistance.

When I try to create a file or folder, I get a message that my file or folder name is too long
Symptom
When you try to create a new file or folder, you may see the following message:

The specified file or folder name is too long. The URL path for all files and folders must be 260 characters or less (and no more than 128 characters for any single file or folder name in the URL). Please type a shorter file or folder name.

Resolution
File and folder names cannot be longer than 128 characters. Additionally, the complete URL to the file cannot be longer than 260 characters. Click the Back button in your browser, and then type a new name.

I cannot delete a site. I get the message "You can't delete a site that has subsites"
Symptom
When you try to delete a site, you may see the following message:

Error deleting Web site "/sitename/subsitename". You can't delete a site that has subsites.

Resolution
To delete a site, you must first delete any subsites that exist below it.

When I try to create a file or folder, I get a message that my file or folder name contains invalid characters

Symptom
When you try to create a new file or folder, you may see the following message:

The file or folder name "File/Folder Name" contains invalid characters. Please use a different name. Invalid characters include the following: # % & * :<>?/\{|}.

Resolution
Certain characters are prohibited from use in file and folder names in Windows SharePoint Services 3.0. Type a name for the file or folder that does not contain any of the invalid characters.

I cannot delete myself as the owner of a site collection


Symptom
When you try to delete the owners of a Web site collection, you may see one of the following messages:

You cannot delete the owners of a Web site collection.

You cannot remove the owners from the list of Web site collection administrators.

Resolution
You cannot remove your own account from the Site Collection Administrators group. Contact another site collection administrator or the server administrator and request that your name be removed from the Site Collection Administrators group.

When I try to delete a file, I get a message that the file is currently checked out or locked for editing by another user
Symptom

When you try to delete a file, you may see the following message:

The file is currently checked out or locked for editing by another user.

Resolution
You cannot delete a file that is currently checked out by another user. Contact the user who has the file checked out and ask him or her to check in the file, or contact the site owner for assistance.

When I view the home page of my site, I get a Web Part error message
Symptom
When you view the home page of your site, you may see one of the following messages:

Web Part Error: One of the properties of the Web Part has an incorrect format. Windows SharePoint Services cannot deserialize the Web Part. Check the format of the properties and try again.

Web Part Error: Cannot deserialize (convert an XML stream back into an object) the Web Part on the server.

Resolution
If you see either of these messages, notify your server administrator.

I get a "service unavailable" message when I try to view my site or the administration pages for my site or server
Symptom
When you try to view a site, you may see the following message:

Service Unavailable

Resolution

If you see the message "service unavailable," there is a problem with the application pool for the Web application. Notify your server administrator.

When I try to view the Site Usage Report page, I get a message that usage reports are not available
Symptom
When you try to view the Site Usage Report page, you may see the following message:

A usage report is not available for this site. Usage processing may be disabled on this server or the usage data for this site has not been processed yet.

Resolution
Logging and usage processing must be turned on, and users must have visited a page on your site before any data can appear on the Site Usage Report page. Contact your site administrator to verify that logging and usage processing are turned on in Windows SharePoint Services 3.0. Also, if the site is new (created today) or has not been used before today, no data will appear until the usage log processing is completed (usually within 24 hours). Furthermore, if there has been no activity on the site for the past 31 days, you will see the "no data" message.

When I try to upload a file, I get a message that the file has "exceeded the maximum length allowed"
Symptom
When you try to upload a file, you may see the following message:

The form submission cannot be processed because it exceeded the maximum length allowed by the Web administrator. Please resubmit the form with less data.

Resolution

The default maximum file size for a file that is being uploaded to Windows SharePoint Services 3.0 is 50 megabytes (MB). Server administrators can increase or decrease the file size, as needed. Contact your server administrator to request that the upload file size be increased.

When I try to upload a file, I get a message that the file has been blocked by the server administrators
Symptom
When you try to upload a file, you may see the following message:

The file you are attempting to save or retrieve has been blocked from this Web site by the server administrators.

Resolution
By default, Windows SharePoint Services 3.0 prevents certain file types from being uploaded to the server. Server administrators can add or remove file types from this list, as needed. Contact your server administrator to request that the file type be unblocked.

I cannot send e-mail to a user after giving the user new permissions
Symptom
When you try to send an e-mail message to a user after you give the user new permissions, you may see the following message:

The user or users have been added successfully, but there was an error in sending the e-mail message. The server may not be set up correctly to send e-mail. To verify that e-mail is configured correctly, contact your server administrator.

Resolution
This message appears if the SMTP server is not valid or is not responding when

you select the Send welcome e-mail to the new users check box while you are adding a new user to a site, list, or library. Notify your server administrator that there is a problem with SMTP.

I cannot create any more alerts


Symptom
When you try to create an alert for a list or library, you may see the following message:

You have created the maximum number of alerts allowed for this site. You can manage your alerts from the 'My Alerts on this Site' page.

Resolution
Windows SharePoint Services 3.0 sets a limit on the number of alerts that a user can create. This number is automatically set by default but can be increased or decreased by your server administrator. Contact your server administrator to request that the alert quota be increased.

I get a message that my site has exceeded the storage quota


Symptom
When you try to add data to your site, you may see the following message:

Your changes could not be saved because this SharePoint Web site has exceeded the storage quota limit. You must save your work to another location. Contact your administrator to change the quota limits for the Web site.

Resolution
Server administrators are able to set limits on the amount of storage space that sites can use on the server. Contact your server administrator to request that the storage quota for the Web site be increased.

Exam 70-667 Microsoft Office SharePoint 2010 Configuration Lab Manual

You might also like