I use SPWebApplication.UpdateMappedPage to update the default application pages with my custom pages. This seems to work with Sharepoint 2010. However, when I use the same code in SharePoint 2013 on any WebApplication, it does not reflect the changes. It defaults back to the specific SharePoint page (ex: 15\layouts\accessdenied.aspx) and does not use my custom page (ex: 15\layouts\custompages\accessdenied.aspx).
When I use this command:
Get-SPCustomLayoutsPage -Identity "AccessDenied" -WebApplication MyWebApp
it shows that the WebApplication is updated with the new value.
I have followed the steps from : http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebapplication.updatemappedpage.aspx but does not work on SharePoint 2013.
Is there something that I'm missing here?
This is an identified issue and will hopefully be resolved in a future hotfix. Here are my findings: http://blog.randomdust.com/index.php/2013/07/custom-access-denied-page-in-sharepoint-2013/
PowerShell Script:
We created and applied the custom Access Denied page in the web applications
Create the “custompages” folder in Layouts folder and WEB FRONT END server:
"c:\Program files\Common Files\Microsoft Shared\Web Server Extensions\
15\TEMPLATE\LAYOUTS\ custompages \Accessdeniederror.html"
Run PowerShell Command :
Set-SPCustomLayoutsPage –Identity "AccessDenied" –RelativePath
"/_layouts/15/custompages/Accessdeniederror.html" -WebApplication "http://raghuserver/"
Check Custom Layouts Pages Applied:
Get-SPCustomLayoutsPage –WebApplication “http://raghuserver/”
Run iisreset.exe.
Related
I am currently training on sharepoint and have few weeks experice with regards to development in sharepoint. My current task involves deploying a .wsp solution on a server farm, and did that using the powershell through the Add-SPSolution, Install-SPSolution, and did that successfully. The problem I am encountering is that in the spsolution I had a webpage named TestPage.aspx, I cant find where the page is residing such that I can access it. there a specific place where the page resides or any command which I can use?
Visual Studio usually creates a folder for application pages, so you may try:
http://server/site/_layouts/foldername/TestPage.aspx
where foldername is the name of your project/solution.
If you get "The resource cannot be found" - HTML 404 error, the site is not there.
Otherwise, even if it says "An Unexpected error has occurred" it does not mean the site is not there.
The site may exist, but has some errors. In that case the best way would be to check Windows Event Viewer and logs.
You cannot just add an aspx file and deploy on sharepoint.
Maybe what you are after is how to deploy an application page, an application page sits at the application level, so every site collection will be able to access it.
How to deploy an application page:
To add an application page do the following:
create a new empty sharepoint project
add "Sharepoint "Layouts" Mapped Folder to the project
in layouts folder create a folder (usually the name of the project)
add an application page to that folder.
that application uses sharepoint masterpage, put some content in.
Deploy using visual studio or compile and deploy the wsp using the method above
access the page in /_layouts/foldernamed/test.aspx*
If you are looking only to add some content to a sharepoint page, then I suggest you use a visual web control. it is basically a user control wrapped in a webpart. After deployed you can add it to a webpart page that you can create using the Sharepoint UI.
Using SharePoint 2007, how could I allow the adding of CEWP's to the selection menu of an "Add a Web Part" dialog while in Edit Page mode? As of the moment, I can only add Announcements, Calendar, Links, Shared Documents, Tasks but I do not have the ability to add a CEWP. I have full access to the site.
At Site Settings > Site Features > Site Collection Features, you will want to have the Office SharePoint Server Publishing Infrastructure set to active.
Then, on the site, go to Site Settings > Site Features, and activate the Office SharePoint Server Publishing feature. You should then be able to add the content editor web part to the site.
Quite often I see SharePoint 2010 websites without the Content Editor webpart (MSContentEditor.dwp)
To enable this web part you need to activate the BasicWebParts feature on that site. I did not find an option to do this by the web site admin; you can enable the feature however by using SharePoint powershell.
Execute the following statement in the SharePoint Powershell and the Content editor web part will be added to your site
Enable-SPFeature 00bfea71-1c5e-4a24-b310-ba51c3eb7a57 -Url [SharepointSiteUrl]
To get the SharePoint site url just run
Get-SPSite
Gertjanvanmontfooort blog
I ran into a similar issue in SharePoint 2010, but I couldn't see other webparts due to my user permissions on the Site Collection. After getting "Restricted Read" rights on the Site Collection I could see all of the different WebParts.
Here is what helped me fo Sharepoint 2013 Online (Office365):
http://answers.microsoft.com/en-us/msoffice/forum/msoffice_o365admin-mso_manage/problems-opening-a-site-from-sharepoint-designer/d1e71427-be3f-4ea7-be3b-8ba6b64af76c?page=2&auth=1
Basically, I had to set flag DenyAddAndCustomizePages to 0 using sharepoint power shell.
Moreover, from time to time I had to reset the flag to 0 as the online sharepoint seems to reset it to deafult 1.
After trying all the above, and other proposed solutions, my eventual success was through PowerShell script. Admittedly I did check that Custom Scripts was permitted and I did have to Activate the two "SharePoint Server Publishing" features described above, but as I am using a sub-site I presmume something else must have been messed up. In the end the following script allowed me to see the Content Editor option when adding a Web Part:
SET-SPOSite -DenyAddandCustomizePages 0
The full article can be found here:
https://answers.microsoft.com/en-us/msoffice/forum/msoffice_o365admin-mso_manage/problems-opening-a-site-from-sharepoint-designer/d1e71427-be3f-4ea7-be3b-8ba6b64af76c?page=2&auth=1
i have a bit of stupid question, but i'm really having trouble with it.
I have a wsp project which i have successfully added to MOSS 2007 using stsadm.exe and deployed it via sharepoint central administration. This has created a new folder in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\ with solution files, so my issue is how to use/create workspace using this solution. I have no new feature, site type etc. in my sharepoint. The solution had been created by another developer whom i cannot contact.
Deploying it through Central Admin isn't the same as activating the feature.
There are several scopes in which a feature could belong:
Web
Site
Web Application
Farm
Only solutions targeted to Web or Site can be activated within SharePoint UI. The others are done through Central Administration. On activation of the feature is when work is performed.
Site: Site Collection Features
Web: Site Features
If you want to see what's in the WSP, you can make a copy and change the extension to .CAB and browse the files. Any DLLs will be likely deployed to the GAC.* If you look at the other XML files you can see what's in them and guess where they are going. Chances are pretty big the feature is Site or Web scoped. If it contains a SharePoint Timer Job, it'll be either Web or Farm scoped but could be Site scoped as well.
The only thing that could be complicated is features can be marked as hidden. If this is the case, the feature won't show in the Site- or Site Collection Features area. Instead you'll have to activate using an STSADM command (activatefeature) passing the name or GUID along with the URL where you'd like the feature activated. You can find this info by opening the WSP and looking at the XML files within.
*Some DLLs might just be feature receivers - code that will run on Feature Activation or Deactivation to do some additional things through the OM.
Is there any other ways of exporting a sites as solution in SharePoint Foundation 2010 except through "Site Settings -> Site Actions -> Save Site as Template"?
Seems to be the only way, just to make sure I'm not missing anything (through the designer probably? There's an option in the designer, but it brings you to the same "Save Site as Template" page)
Thanks!
In the out-of-the-box UI that's the only place to export a site, but note that unlike sp2007 this now export your site as a wsp-package
In the object model there are a couple of ways to export the site:
SPWeb.SaveAsTemplage
SPSolutionExporter.ExportWebToGallery
SPSolutionExporter.ExportWeb
AS part of Microsoft Course 10325A - Windows PowerShell 2.0 - backup / restore site collections.
PowerShell creates Cabinet files or .CAB files - http://en.wikipedia.org/wiki/Cabinet_(file_format). One nice thing about PowerShell is automation and you can easily perform the same task as you would via SharePoint 2010 Central Administration, in the Backup and Restore section.
Being scripted, you can provide any extension for your backup file. Extract and View the archive contents and modify, using "Extract.exe", provided with early versions of Windows and replaced in XP with "Expand.exe".
Rebuilding modified CAB files, is achieved with "MakeCab.exe", the Microsoft Cabinet SDK "CabArc.EXE" or any application supporting "application/vnd.ms-cab-compressed".
To restore a site collection using Windows Power Shell, from the Start menu, All Programs > Microsoft SharePoint 2010 Products.
Open SharePoint 2010 Management Shell (launch with Administrator rights, if required by right click and choosing "Run as Administrator").
Backup-SPConfigurationDatabase
Backup-SPFarm
Backup-SPSite
Get-SPBackupHistory
Restore-SPFarm
Restore-SPSite
The most fitting to your requirement;
Backup-SPSite
Restore-SPSite
Backup-SPSite http://server_name/sites/site_name -Path C:\Backup\site_name.bak
Restore-SPSite http://server_name/sites/site_name -Path C:\Backup\site_name.bak
Great book filled with automation scripting with PowerShell, the book by Gary Lapointe - Automating Microsoft SharePoint 2010 Administration with Windows PowerShell 2.0
.Net namespace for C# code within PowerShell or PowerShell within.Net applications;
Microsoft.SharePoint.Publishing.Administration
So i just started trying to develop a simple webpart today for a sharepoint foundation i put on a virtual machine. I have no previous experience with sharepoint whatsoever.
As i cant run a sharepoint 2010 on my local machine for dev purposes i followed advices in this thread http://social.technet.microsoft.com/Forums/en/sharepoint2010programming/thread/cda807f6-4edf-4efc-8e9b-4d446356c8ae to able to actually develop something (just the registry bit).
I created the simple test web part (writes out "hi"), uploaded it to virtual machine, added it with add-spsolution and install-spsolution in powershell with success. When i do get-solution through powershell on my webpart it says deployed = true.
What am i missing from here to get it to actually show up somewhere in the web interface so i can add it to a page?
Cheers
You need to go into site settings and activate the feature. If its already activated edit the page > Insert WebPart > Look under Custom to find your webpart.
HTH