When I am looking at a Sharepoint site home page, how can I tell if it is a site collection or a site? I also have the admin permissions if that helps, but, as you can see, no administration knowledge. :-)
A site collection will be at the top level after your sites qualifier (by default, this is "sites").
So http://[server.domain]/sites/First is a site collection,
But http://[server.domain]/sites/First/Second is site within the site collection.
Another way (if you are a site collection administrator) is to go to the site settings for any site. If you see the 4th column on the right labeled "Site Collection Administration" then you are at the top of a site collection. If you see "Go to Top Level Settings" then you are in a subsite.
You can also get a full list of all site collections from the Central Administration -> Application -> Site Collection List
If you create an instance of an SPSite object by passing an URL into its constructor, the SharePoint API will create a valid object out of that.
Now, if you call OpenWeb() on that object, you will get an instance of the SPWeb object that your given URL refers to.
Then you can compare the SPSite.URL (url of the root web of that site) to SPWeb.Url (url of your web). If they are the same, you have an url of a site collection.
Your code will look something like this (I don't have Visual Studio with me at the moment, so this is just pseudo-code)
string sUrl = "http://someserver/zeiten/mysite1/someweb";
Using (SPSite oSite = new SPSite(sUrl)){
Using (SPWeb oWeb = oSite.OpenWeb()){
if (oWeb.Url == oSite.Url) {
//sUrl refers to a site collection
} else{
//you actually have an url of some sub-web
}
}
}
See responses to a similar question of mine:
Finding SharePoint list item by its display form's URL
Looking only at a homepage, there is no way to distinguish between a site collection and a site. A site collection is basically nothing more than a container with a root site in it (SPSite.RootWeb in code). That root site (or web / SPWeb in sharepoint terms) can have other sub sites (webs) under it.
A web application contains one or more site collections. Site collections can be grouped together using managed paths that are defined in the Central adminstration. a managed path is either explicit or wildcard. explicit means only site collection can be created in that managed path, i.e.
http://rootsitecoll/explicitpath/
where the explcit managed path IS the new site collection's url.
Wildcard means 1 or more site can be created under the managed path, i.e.:
http://rootsitecoll/departments/departmentsite, where departments is a wildcard managed path.
Related
Is there any way, to find all subsites of a site? Even those, which are not referenced by this site.
For example: I have site www.foofoo.de, this site has 3 subsites - www.foofoo.de/horse, www.foofoo.de/dog, www.foofoo.de/mouse. Site www.foofoo.de has links to /horse and /dog but not to /mouse. However i can still visit site www.foofoo.de/mouse if I specifficaly write this adress to my web browser. Is there any way, I can find this subsite if I dont know it's complete adress, just www.foofoo.de?
Thanks
You can try to find out if it has a sitemap. Either it has it set to public and visible to users on www.foofoo.de/sitemap, or as a file on the webserver, reachable for bots like google on like www.foofoo.de/sitemap.xml
But the owner can decide, which sites they want to list on the sitemap.
Is there a way to set the home/landing page for a SharePoint 365 site to the Site Contents page https://support.office.com/en-us/article/The-SharePoint-Site-Contents-page-ba495c1e-00f4-475d-97c7-b518d546566b
You could add a script on startpage in a script editor web part that redirect users to Site contents. That redirect surely will create a "flicker".This should do it:
window.location.href = "/_layouts/15/viewlsts.aspx";
Beware that this will be hard to remove from the web part (you will always get redirected), so maybe it should be added to a new page layout that is used by the startpage. Then it's possible to edit/remove the redirect through SharePoint Designer.
You could also try (if you have publishing feature activated) the "Welcome Page" link in site settings. Maybe there you could somehow point out the path to site contents, but I doubt it.
I'm retrofitting a V9 site with a new 'sub site' This site will have it's own navigation system and IA. My plan, maybe, is to create a new folder in the content tree named 'New Site' and then created all my pages and items within there.
For the domain, i would then create a domain alias, and set the 'Default Alias path' to the 'New Site' folder.
This so far seems clear. Is it possible to have cross site contamination? Ideally, the old and new sites wouldn't mix under a single URL. I'm worried about navigation on the old site ('css list menu') picking up pages from the new site.
Had i know this was the plan, i would have created folders for each site to isolate, but moving to that structure may cause a lot of problems.
Based on the answers you posted, what I've done in the past is to:
create a new page type called Divisions or whatever you'd like.
Then create a new page template which doesn't inherit anything from the master page and flag it as a master page. Add the webparts you need on there, specifically a Head HTML webpart with your stylesheets, js, etc. Because it won't inherit from the main master page. But if you have a stylesheet assigned in to the site in the Sites application, that will be inherited unless you specify otherwise on the General tab of each new sub site.
Back on the page type you just created set the default page template to be the master page you just setup.
Add a new sub site/page to the content tree
Add new pages under the sub site in the content tree. Set your navigation path to be /{0}/% so it always selects the sub site as the root.
In your other master page you shouldn't need to worry about the other pages, because the parent page won't be visible in the navigation so the children won't show.
I'm having quite a hard time figuring out this problem and I need your help. Here's the scenario:
I have a sharepoint 2010 web application on my port 80. This has 2 site collections, the root, and the /sites/official. My problem is: The root site is empty, but in the future it will be my something (I don't know what yet), but my other site collection is ready to go and I already have an Internet address for it.
What I want to do is configure everything in way that I can type http://contoso.com and get as response my sub-site (yes, its a kind of redirect)...
how can I do it? What and where should I configure it?
add content editor webpart on your root site collection and put this javascript in that webpart
<script type="text/javascript">
window.location = "http://contoso.com/sites/official"
</script>
Open IIS manager
Right click on your SharePoint website -> Properties
Go to tab Home Directory
Choose A redirection to a URL
fill the URL for redirection. for example: http://contoso.com/sites/official
Notes:
Make sure to check A Directory below URL entered to avoid redirect loop
Link to another thread might interest the reader - immediate redirect page in sharepoint
Screenshot:
Add alternate access mapping for the sub-site collection from the central administration.
Central Administration > Application Management > Web Applications > Configure alternate access mappings
I want to create a link in a portlet so that I can navigate to a different page in the liferay portal. I order to do that I am looking for an API (can be liferay specific) that given a page name, would return it's url (it can be the friendlyURL as well).
Portal pages in Liferay are indeed called Layouts in APIs and DB tables. They're identified by plid field, can be obtained using LayoutLocalServiceUtil and related APIs, and also from some other calls like themeDisplay.getLayout().
However in order to build String containing URL to a page you'll have to concatenate friendly URL of portal, group and layout itself (i.e. /web/guest/home - web is portal URL for public pages, guest is friendly URL of guest group by default and home is friendly URL of home page/layout by default). This can be tricky, as you have to check whether this is a public or private page, etc.
And once you start using virtual hosts with friendly URLs for groups, things change. So this is not a good way.
To avoid manually creating URLs and have URLs that are guaranteed to be correct you should use com.liferay.portal.util.PortalUtil.getLayoutFriendlyURL(Layout layout, ThemeDisplay themeDisplay) a static method of PortalUtil - it'll do all the necessary work for you. Though you also need to provide ThemeDisplay and not only Layout.
The API to access pages in Liferay is the LayoutService. However, page names are not unique in Liferay and furthermore they are internationalized. So you need some unique property for a page to retrieve its url, besides its name.
If you really only have the page name, you can use LayoutLocalServiceUtil.getLayouts(...) to loop over all Layouts and check for some property (in this case its name).
At least in Liferay 6.1.20 one can use 'Link Portlet URLs to Page' to make links proceed to antoher page in your portal. It is under ´look and feel´ menu item of your portlet. For me this works fine.
cheers
try this one for current url
${themeDisplay.getURLCurrent()}
try this one for portal url
${themeDisplay.getPortalURL()}