How to add Promoted links web part to page and set JSLink - sharepoint

I am trying to deploy a Promoted links web par to the default.aspx page, following the article from Muawiyah Shannak http://code.msdn.microsoft.com/office/Sharepoint-2013-How-to-add-e2966a24#content
But I cant find out how to set the JSLink url in the markup.
<div>
<WebPartPages:WebPartZone ID="WebPartZone" runat="server" FrameType="None">
<WebPartPages:XsltListViewWebPart
ID="XsltListViewArticlePromotedList"
runat="server"
ListUrl="Lists/MyPromotedLinks"
IsIncluded="True"
NoDefaultStyle="TRUE"
Title="Images used in switcher"
PageType="PAGE_NORMALVIEW"
Default="False"
ViewContentTypeId="0x">
</WebPartPages:XsltListViewWebPart>
</WebPartPages:WebPartZone>
</div>

XsltListWebPart.JSLink property sets CSR file to rendering the List View:
<JSLink>~site/SiteAssets/PromotedLinks.js</JSLink>
where ~site is a URL token.
Please refer URLs and tokens in SharePoint 2013 for a more details.

Related

Doesn't Azure AD B2C Page UI Customization Support Bootstrap?

I'm trying to customize the page UI on Azure AD B2C unified sign in/sign up page.
I was able to create my template and upload all the assets i.e. html page, images and css to my Azure Blob Storage container with the right CORS settings.
When I pull up the page, however, it looks absolutely HORRIBLE! It doesn't seem to support Bootstrap. I read somewhere that no JavaScript is allowed. Is that the reason for this?
Once I upload my custom HTML page, Azure AD B2C seems to be stripping off a lot of the design elements necessary for my customization such as id and style in my body tag -- see below:
<!-- Omitted for brevity -->
<body id="my-login-class" style="url: ('https://myazurestorage.blob.core.windows.net/my-container/my-bg-image.jpg')">
<div id="some-important-id" class="my-important-class">
<div class="col-xs-8">
<div>Some important message</div>
<div>
<div class="col-xs-4">
<div id="api">
</div>
</div>
</div>
</body>
When I inspect the page source once my custom page is rendered, I see that all my classes and Id's are removed along with Bootstrap references e.g. css and js.
Am I getting this right? No Bootstrap which means Azure AD B2C only supports customization of the most basic kind?
Your HTML template can include any external, head, or inline styles but it can't include scripts.
An example of a customized page can be found at the WoodGrove sign-up or sign-in page.
The HTML template for this customized page can be found in the WoodGrove GitHub repository.
This HTML template includes Bootstrap's Reboot styles as well as the WoodGrove's specific styles.
Azure AD B2C creates the head and body elements and then copies the child elements for each of these head and body elements from your HTML template to its HTML document.
Therefore, you shouldn't add attributes to the body element in your HTML template, because they aren't copied.
You can import the bootstrap references. Please see this document: https://learn.microsoft.com/en-us/dynamics365/customer-engagement/portals/azure-ad-b2c
See also: https://github.com/Azure-Samples/active-directory-b2c-php-webapp-openidconnect
It looks horrible for a reason. No styling is applied to the page so that it can be fully customizable. You can reference Bootstrap for CSS; however, I have run in to issues when using bootstrap.js for modals since it appears the Azure B2C API uses bootstrap for modals...In my experience, it is best to rely on Vanilla JS and to leave off any references to third-party JS.
It is possible to use JavaScript if you are using your own custom policies. There are some limitations to JavaScript and the best approach is to try to accomplish anything using the policy first.
To enable JavaScript use the following as guide:
<RelyingParty>
<DefaultUserJourney ReferenceId="SignUpOrSignIn" />
<UserJourneyBehaviors>
<ScriptExecution>Allow</ScriptExecution>
</UserJourneyBehaviors>
...
</RelyingParty>
When referencing external CSS/JS files, the URL must be absolute. This is true for the head section of HTML files as well as any references within JavaScript. Relative URL's can only be referenced within a CSS file.
Incorrect:
<link href="./css/assets.css" rel="stylesheet" type="text/css" />
Correct:
<link href="https://your-storage-account.blob.core.windows.net/your-container/css/assets.css" rel="stylesheet" type="text/css" />

SharePoint Link with QueryString Parameters

The task is to migrate classic ASP functionality to SharePoint Server 2013.
On the ASP page, a certain link is visible only if the authenticated user's password can be retrieved from a database. The link looks similar to:
<a target="_blank" href="https://www.someurl.com/secure/login.php?username=<%=strUserName%>&password=<%=rsOpenOrders("CL_password")%>" onmouseover="self.status=' '; return true;">
<img border="0" src="somelogo.gif" width="267" height="80" /></a>
I'm new to SharePoint, and I would appreciate your help (conceptual and code snippet) in solving this problem.
I understand that writing "code behind" is not highly encouraged with SharePoint pages and web parts.
So, what's the best alternative to be able to use the authenticated username value in building the first querystring parameter, and to query a SQLServer database to retrieve the value for the second querystring parameter? Please ignore the security concern here. Thanks!
its called SPSecurityTrimmedControl
example:
<%# Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl1" runat="server"
AuthenticationRestrictions="AuthenticatedUsersOnly" Permissions="ManageWeb" PermissionContext="CurrentSite">
<INCLUDE OUR CONTROL / CONTENT HERE>
</SharePoint:SPSecurityTrimmedControl>
I ended up creating custom web parts developed using Visual Studio 2013 for each particular link that needed query string parameters to be built based on values retrieved from database.

How to add custom user control in SharePoint 2013 HTML master page

I am trying to add custom usercontrol in SharePoint 2013 HTML master page, but its not working and showing the message
SharePoint can't parse this file, most likely because of an incorrectly formatted SharePoint snippet. The markup at the following location is causing problems. Edit the markup manually to fix it, or replace it with a new snippet from the Snippet Gallery.
Invalid SharePoint markup at line 145. Please repair or recreate the markup
following is the code snippet for HTML master page.
<!--CS: Start Create Snippets From Custom ASP.NET Markup Snippet-->
<!--SPM:<%# Register Src="~/_controltemplates/15/SharePointProject1/UserControl1.ascx" TagPrefix="uc1" TagName="MyDepartmentControl" %>-->
<!--SPM:<uc1:MyDepartmentControl runat="server" id="MyDepartmentControl1" />-->
<!--CE: End Create Snippets From Custom ASP.NET Markup Snippet-->
Please help me how i can make it possible to add asp.net user-control in SharePoint 2013 HTML Master page.
Thanks in advance.
I just solved this problem.
The answer is; convert this line
<!--SPM:<%# Register Src="~/_controltemplates/15/SharePointProject1/UserControl1.ascx" TagPrefix="uc1" TagName="MyDepartmentControl" %>-->
to
<!--SPM:<%# Register TagPrefix="uc1" TagName="MyDepartmentControl" Src="~/_controltemplates/15/SharePointProject1/UserControl1.ascx" %>-->
Have fun..

not working iframe opps

<#iframe src="http://www.turkiyewebservisi.com/reklam.html" runat="server" id="iframe1" width="500" height="500"><#/#iframe>
This is my code. When I add it to another site it does not work.
that other site would have to support the runat="server" attribute. is that other site running on ASP.net?

MOSS 2007 team site page title

I'm trying to display the page title (html title) on the default.aspx page of a custom site template. The template is based on a MOSS team site template.
But the html page title is rendered empty. Can I change the code in the default.aspx and/or the sites master page to define the title myself? Details of the deafult.aspx and default.master page as below: Thanks.
Default.aspx:
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,multipages_homelink_text%>" EncodeMethod="HtmlEncode"/>
- <SharePoint:ProjectProperty Property="Title" runat="server"/>
</asp:Content>
default.master
<Title ID=onetidTitle><asp:ContentPlaceHolder id=PlaceHolderPageTitle runat="server"/></Title>
I'm not sure a understand your problem, but have you tried to enter your title like this in your .aspx file:
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
This is my title</asp:Content>
Or am I missing something obvious here?
Do you want to do it in code?
You maybe also have stumbled upon this bug. (although it's Ajax specific)
2 additional things:
Have you checked-in, published and approved the master page?
Have you checked in the .aspx page?
If you have Sharepoint Designer, then its matter of fiew clicks to modify page title.
I checked the Master page the site was inheriting which was the site template master page. I change the title tag to display the site title using the Sharepoint ProjectProperty tag and property title.
<Title ID=onetidTitle> <asp:ContentPlaceHolder id=TSM_PlaceHolderPageTitle runat="server">Parent Site Title- <SharePoint:ProjectProperty Property="Title" runat="server"/></asp:ContentPlaceHolder></Title>

Resources