I have a SharePoint hosted app.
There is a list in that app, and it is brought through web part on the page.
<div>
<WebPartPages:WebPartZone runat="server" FrameType="None" ID="WebPartZone" >
<WebPartPages:XsltListViewWebPart
runat="server"
ListUrl="Lists/IdeasList">
</WebPartPages:XsltListViewWebPart>
</WebPartPages:WebPartZone>
</div>
Everything works well but there is one problem, in case of application updating the page on which is placed a web part is replaced normally (html a code), but the web part is duplicated (on the page one more copy of web part is added below).
How to add web part on the page that it wasn't duplicated in case of updating?
I had the same issue and what I did is to remove the webparts before update.
You can delete them manually via URL.
Another option is to implement an event receiver which will delete the webparts before.
Hope this helps you.
Related
I found out about the SPSecurityTrimmedControl and supposedly it allows us to control web content on SharePoint. For example:
<SharePoint:SPSecurityTrimmedControl runat="server" Permissions="ManageWeb" PermissionContext="CurrentSite">
<p>Not everyone can see this</p>
</SharePoint:SPSecurityTrimmedControl>
My question is, where can this be used? Can this be used only in SharePoint Designer? I tried inserting this code in a Script Editor web part but it does not seem to work.
SPSecurityTrimmedControl server side control is not supported to be embedded via Script Editor web part, instead you could enclose web part zone (WebPartZone) in SPSecurityTrimmedControl control (apparently the page that contains web part zone(s) needs to be modified for that purpose):
<SharePointWebControls:SPSecurityTrimmedControl ID="stc" runat="server" PermissionsString="AddListItems">
<WebPartPages:WebPartZone ID="Right" runat="server">
<ZoneTemplate>
</ZoneTemplate>
</WebPartPages:WebPartZone>
</SharePointWebControls:SPSecurityTrimmedControl>
From another hand you could consider to utilize Target Audiences to target web part to specific audiences:
Go to Edit page -> edit Web Part -> Target Audiences under Advanced group
I have had an app targeted for SharePoint online which provisions a few custom lists and custom list forms that has been, and continues to work on my work Office 365 team site.
I made some changes to the app and on my developer account, references like:
<SharePoint:FormField runat="server" ID="FieldId" ControlMode="New" FieldName="FieldName" />
are not rendering at all on custom list pages, aside from one list, whose custom pages oddly appear to continue functioning.
I have been pulling my hair trying to figure the source of this for hours not to no end. I have even created an app that does nothing but provision a list and a custom form and on deployment to my developer account, form fields do not render (the HTML rendered on visiting these forms is something like this:
<span id='WPQ1f257f1df-1870-4fef-a590-4f29baa6e99bIPName' data-sp-control='SPFieldText' data-sp-options='{"mode":3,"source":"IPName"}'></span>
without the html input controls as it happens on the working form.
Hoping there is someone in here who may have ideas as to what could be the cause of this.
I am working on a POC for site templates and sites. I am able to get the propagation of the changes from the site template to the site, but there is something that seems to be un-comforting:
What I am doing here:
I created a site template, and added say a blog, navigation,
calender to it.
I created a site named A which is using the
aforementioned site template.. thus I can see those above configured
applications in site A.
Now I added some site A level apps like
wiki, and polls.
Now, I get a message that says "Reset changes" (as the site changes are not same as its template). So I did a reset and all site level changes like wiki and polls are lost.
I know we can disable propagation of these changes, post site creation, but we have a requirement as per which we need to update content in the site template, which should be propagated, to all the sites using that template, ensuring all the site level changes are intacted.
Question:
Is there a way wherein we can sustain the site level changes, along with the new changes in the site template (reset does not seems to be working as per this requirement)?
Note: We are looking for an out-of-the-box solution from Liferay, before jumping to any customization (but any idea on would be welcomed).
Liferay version : Liferay Portal Community Edition 6.2 CE GA2 (Newton / Build 6201 / March 20, 2014)
Any pointer would be a great help.
Cheers!!
AJ
I ran into a similar problem with a project I am working on. The main drawback of site templates with propagation is exactly what you describe - any changes on the child sites can be wiped out by this propagation.
I took an approach that utilizes OOTB liferay features but requires development work for changes by embedded portlets into page layouts. You can also embed some basic portlet configuration in layouts as well. Here's a snippet from one of the layouts we are using:
#set($customTitlePreference = "<preference><name>portletSetupUseCustomTitle</name><value>true</value></preference>")
#set($noBorderPreference = "<preference><name>portletSetupShowBorders</name><value>false</value></preference>")
#set($basicPreferences = "<portlet-preferences>${customTitlePreference}${noBorderPreference}</portlet-preferences>")
<div class="three_columns" id="main-content" role="main">
<div class="portlet-layout">
<div class="portlet-column portlet-column-first" id="row-1-column-1">
$theme.runtime("85", "", "${basicPreferences}")
$theme.runtime("56_INSTANCE_RELATED", "", "${basicPreferences}")
$processor.processColumn("row-1-column-1", "portlet-column-content portlet-column-content-first")
</div>
</div>
</div>
This is only the first column, but it shows a site map (pid 85) and a web content display with a specified instanceId (pid 56). This is the first of three columns, and this technique folds seamlessly into all layout components.
Each page can have its own layout, or you can re-use layouts across different pages. Any updates to the layouts that are deployed to the server will propagate to each page using the layout but not destroy the customizations made to the pages. The only functional downside to this is that portlets can only be added to the bottom of each column, as the embedded portlets will be rendered first. You can circumvent this by being clever with rows and columns in your layouts.
In a number of different WSS and SharePoint sites we typically add a LeftNavZone to the default.aspx page using MS Office SharePoint Designer. I'd like to write a feature to do this programatically so it can be activated only on certain sites.
Is this possible?
I would like to add it within
<asp:Content ContentPlaceHolderId="PlaceHolderLeftActions" runat="server">
You cannot add an WebPartZone to the Pages using a feature. You will have to manually do it, but whereas you can add an webpart to the page using this AllUserWebPart
The way you would normally do this is by creating a site definition using Visual Studio, in which you include all items that should be deployed to the site, like for instance the default page. This allows you control the creation of a new site.
Option 2 is creating a feature that does 2 things.
Deploy a new aspx called homepage.aspx to the site, this page contains the desired controls etc.
a feauture receiver that is executed when the feature is activated, which sets the site's homepage programmatically to be the newly deployed page.
I have a custom feature which adds a few controls into the AdditionalPageHead DelegateControl. This works fine on any sites which use our default.master. However the project requires the use of a publishing site which has a master page derived from BlackBand.master (which does not have the AdditionalPageHead DelegateControl included), so I made a copy of the master page from the master page gallery on the appropriate site collection and then modified it to include the following line:
<SharePoint:DelegateControl
ID="DelegateControl1"
runat="server"
ControlId="AdditionalPageHead"
AllowMultipleControls="true"/>
This should therefore include this DelegateControl within all pages using this master page. However when this is uploaded as a new version of BlackBand.master and approved as such, all the pages in the site that use it get a 404 error as if they no longer exist. If I restore the previous version of the master page then everything return to normal.
Help is appreciated as always.
The answer was that I was approaching the solution to my problem incorrectly.
To fix this I opened SharePoint designer at my site collection root and clicked on _catalogs/masterpage. Then I made a copy of BlackBand.master in the masterpage catalog. Opened it and added my line of code. Saved it and then set it as my default and custom master page (to ensure that it applied to any straight up web part pages as well as layout pages).
This worked without a problem.