Recently I was having a task for creating Power BI chart and embedding it in SharePoint. So It is easily available in google. But the tricky part is when you embed it in SharePoint as iframe, it will show share button at bottom of it. Our client do not want that.
Here is the bottom of iframe:
So what is solution:
We add a new div tag and append our iframe within that with little css touch. Below is code for same:
Code sample:
<style>
.iframebox{width:100%; float:left;position:relative; overflow:hidden}
.iframefooter{
width: calc(100% - 40px);
background: #eaeaea;
/*background: #eaeaea;*/
height: 31px;
display: block;
position: absolute;
bottom: 5px;
right:40px;
z-index: 9999999999;
}
.blueborder{
position: absolute;
left: 0;
bottom: 41px;
height: 1px;
background: rgb(36, 65, 153);
z-index: 999999999999999999;
width: 100%;
}
.ms-dlgContent {z-index: 99999999999 !important;}
</style>
<div class="iframebox">
<!-- Iframe code goes here -->
<div class="blueborder"> </div>
<div class="iframefooter">
<br>
<br>
<br></div>
</div>
Output:
Happy coding.
Wednesday, 29 November 2017
Saturday, 28 October 2017
How to get Site details in SharePoint Online?
These days, Microsoft is obsoleting code based solution from Office 365. And these leads us to use JavaScript Object Model / Client Side Object Model to get data and add them in to content editor / script editor webpart to display data.
In this blog we will try to get current site title, web tile and any intermediate web title using CSOM. You can go deep down if you have further requirement for these objects.
Here is the basic function to get site details:
Sample code:
var currSiteTitle; // site collection details
var currWebTitle; // get sub site details
var parentWebTitle; // get any intermediate site details
$(document).ready(function() {
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function() {
getWebTitle();
});
In this blog we will try to get current site title, web tile and any intermediate web title using CSOM. You can go deep down if you have further requirement for these objects.
Here is the basic function to get site details:
Sample code:
var currSiteTitle; // site collection details
var currWebTitle; // get sub site details
var parentWebTitle; // get any intermediate site details
$(document).ready(function() {
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function() {
getWebTitle();
});
});
function getWebTitle() {
var context = new SP.ClientContext.get_current();
var site = context.get_site();
var web = context.get_web();
context.load(site);
context.load(web);
var parentInfo = web.get_parentWeb();
context.load(parentInfo);
context.executeQueryAsync(function() {
console.log(site.get_title());
console.log(site.get_url());
console.log(web.get_title());
console.log(web.get_url());
console.log("Intermediate site value: " + parentInfo.get_title());
currSiteTitle = site.get_title();
currWebTitle = web.get_title();
parentWebTitle = parentInfo.get_title();
},
function(sender, args) {
console.log(args.get_message());
}
);
}
Original Source:
- https://msdn.microsoft.com/en-us/library/office/jj246780.aspx
- https://msdn.microsoft.com/en-us/library/office/jj246877.aspx
- https://sharepoint.stackexchange.com/questions/175217/get-parent-web-of-a-subsite-using-jsom-in-sharepoint-2013
Tuesday, 3 October 2017
QueryString-error-The name request does not exist in the current context
After a long time, I was working on .net project. Basically I forget all basic things and on of them was how to use Query String. So here is blog for those who face issue same as me when user querystring and get error :
Below was code I was using:
if (!String.IsNullOrWhiteSpace(Convert.ToString(Request.QueryString["Source"])))
{
Context.Response.Redirect(Convert.ToString(Request.QueryString["Source"]));
}
Solution:
Solution is very easy. First, you need to add below reference in your code:
using System.Web;
This will allow you to use "HttpContext.Current" in your code. So your final solution should look like below:
if (HttpContext.Current != null && !String.IsNullOrWhiteSpace(Convert.ToString(HttpContext.Current.Request.QueryString["Source"])))
{
Context.Response.Redirect(Convert.ToString(HttpContext.Current.Request.QueryString["Source"]));
}
The name request does not exist in the current context
Below was code I was using:
if (!String.IsNullOrWhiteSpace(Convert.ToString(Request.QueryString["Source"])))
{
Context.Response.Redirect(Convert.ToString(Request.QueryString["Source"]));
}
Solution:
Solution is very easy. First, you need to add below reference in your code:
using System.Web;
This will allow you to use "HttpContext.Current" in your code. So your final solution should look like below:
if (HttpContext.Current != null && !String.IsNullOrWhiteSpace(Convert.ToString(HttpContext.Current.Request.QueryString["Source"])))
{
Context.Response.Redirect(Convert.ToString(HttpContext.Current.Request.QueryString["Source"]));
}
Monday, 11 September 2017
Cannot Read Property 'Showmodaldialog' of undefined
While working with SharePoint / JavaScript modal pop up you might encounter error "cannot read property 'showmodaldialog' of undefined". Here is simple solution for that.
Code Sample:
function OpenDocsDialog(url1) {
var options = {
url: url1,
dialogReturnValueCallback: myDialogCallback
};
SP.UI.ModalDialog.showModalDialog(options); // this line gives error.
}
Solution : We need to load "sp.js" file before calling above code. You can load "sp.js" file with below code sample:
ExecuteOrDelayUntilScriptLoaded(function () { //code }, "sp.js")
Full solutionExample :
function OpenDocsDialog(url1) {
var options = {
url: url1,
dialogReturnValueCallback: myDialogCallback
};
ExecuteOrDelayUntilScriptLoaded(function () {
SP.UI.ModalDialog.showModalDialog(options);
}, "sp.js")
}
Code Sample:
function OpenDocsDialog(url1) {
var options = {
url: url1,
dialogReturnValueCallback: myDialogCallback
};
SP.UI.ModalDialog.showModalDialog(options); // this line gives error.
}
Solution : We need to load "sp.js" file before calling above code. You can load "sp.js" file with below code sample:
ExecuteOrDelayUntilScriptLoaded(function () { //code }, "sp.js")
Full solutionExample :
function OpenDocsDialog(url1) {
var options = {
url: url1,
dialogReturnValueCallback: myDialogCallback
};
ExecuteOrDelayUntilScriptLoaded(function () {
SP.UI.ModalDialog.showModalDialog(options);
}, "sp.js")
}
Wednesday, 12 July 2017
Activate Dynamics 365 in Office 365
Recently I have a POC task in Dynamics 365. And I spent some time as I din't know how to activate it. Follow below steps to activate dynamics 365:
- Create Office 365 account (It must be E5 instance. E3 instance do not provide this functionality).
- Once set up you will be able to see dynamics 365 installed.
- But you can't start diging it out directly. There is bit configuration you need to add for activating it.
- First click on admin icon to open admin center.
- Now click on users.
- In this you will see our user. select it.
- In panel, click edit button on "Product licence".
- Enable the Dynamics 365. Click save.
- Now you will be able to see dynamics 365 in admin center. Click on it to open Dynamics365.
- Select your required template. Click on complete set up.
- Once setup, you will see Dynamics 365 Administration center.
Monday, 19 June 2017
0x8007000d the data is invalid when chaging a file name.
Recently I have downloaded a file which was a song. I was trying to update few property of it when I encountered below error:
0x8007000d the data is invalid
Resolution:
I googled this issus and found below blog:
https://answers.microsoft.com/en-us/windows/forum/windows_7-performance/0x8007000d-the-data-is-invalid-when-chaging-a-file/23301e0b-40c8-459d-975e-1abfc9a14758
It contains the solution. so why i need to write this blog? Because it is microsoft blog which may be not understandable to all or you need to do some extra steps your self in google to achieve it.
Below are the steps:
0x8007000d the data is invalid
Resolution:
I googled this issus and found below blog:
https://answers.microsoft.com/en-us/windows/forum/windows_7-performance/0x8007000d-the-data-is-invalid-when-chaging-a-file/23301e0b-40c8-459d-975e-1abfc9a14758
It contains the solution. so why i need to write this blog? Because it is microsoft blog which may be not understandable to all or you need to do some extra steps your self in google to achieve it.
Below are the steps:
- First we need to download a free software. You ca download it from below URL:
URL: http://www.mp3tag.de/en/download.html - Once download, install it in your machine.
- Open the tool. And click on file menu. and then click on change directory.
- Select your source location.
- It will show all files in right side pane.
- Now as per the blog, we need to update ID3 version 2.4 to version 2.3. But when you select your file and check property pane in left side, you can see that tag property is not there.
- Don't worry. Just click save and you will see the version is changed to 2.3.
- Once this is done, you can update your settings in the tool as well as outside of the tool.
Hope this helps.
Thursday, 17 November 2016
3rd Level SharePoint SharePoint Navigation in Global Navigation
SharePoint 2013 only supports one level deep on drop downs. If you
require the navigation to show 2nd level or 3rd level item under the 2nd
level, global navigation will not allow it directly. The other
approaches are you do managed navigation. But it has its own limitations
listed here.
Resolution:
If you require the navigation to show 2nd level menu, you need to make a very minor tweak to the master page that the site is using.
Resolution:
If you require the navigation to show 2nd level menu, you need to make a very minor tweak to the master page that the site is using.
- Using SharePoint Designer (SPD), open the master page being used by the site. In SPD, navigate to _catalogs/masterpage/yourmasterpage.html
- In the master page file, search for SharePoint:AspMenu.
- You will more than likely have more than one instance of a menu control. Look at the IDs to find the right navigation control for what you want to edit. They are intelligently named, you will be able to sort out which one you need. For default.master, look for ID=”TopNavigationMenu”.
- In the properties for the tag, find MaximumDynamicDisplayLevels=”1″. Change the number from 1 to 2. (You need to level till you need navigation)
- Save the file and publish the master page (do this from SPD, Manage Content and Structure, or the Master Page Gallery).
- Refresh your browser. Now when you mouse over menu, you should see another level of navigation pop up.
- If you have more than 2nd level of navigation, you have to first add them separately in global navigation first. Once you save your changes, edit top navigation, drag 2nd level navigation under 1st level navigation.
- If you have more than 2 level navigation, you won't be able to drag 3rd level navigation in 2nd level. For that you need to create your custom master page and do that process.
Limitations of Managed Navigation in SharePoint 2013
When SharePoint 2013 came out, one of the most promising features was the Managed Navigation. Configuring
Managed Navigation in SharePoint 2013 is straightforward and provides great
no-code solution. In this blog,
I will walk through some of the major limitations and why you must avoid this
solution.
1) For each site collection you need separate Term Set.
If
term set is already configured to use for Site Collection navigation and
if you try to reuse same term set in another site collection,
SharePoint will throw following warning “The selected term set is
already used by another site”
2) Managed Navigation can’t be secured or targeted to specific group.
2) Managed Navigation can’t be secured or targeted to specific group.
One
of the great abilities of Structured Navigation was you can configure
audience targeting or secure each menu item for specific audiences or
SharePoint security groups. Unfortunately Managed Navigation can’t be
secured or targeted to specific security group.
3) Manual Maintenance is still required to update global navigation menu items.
3) Manual Maintenance is still required to update global navigation menu items.
As
we discussed earlier, you must have 1 term set for each site
collection. If you have more than 1 site collection, you must have more
than 1 term set dedicated to each site collection. To ensure, all the
site collection uses same navigation menu items, there are two options
available in SharePoint 2013 for replicating term sets. Regardless of
which approach you may take, it will require manual maintenance of
reconfiguring term sets when you have changes in term set.
4) Managed Navigation doesn’t apply to Sub Sites automatically.
4) Managed Navigation doesn’t apply to Sub Sites automatically.
This
is another one of those mind-boggling limitations of Managed
Navigation. If you have enabled Managed Navigation at the site
collection and while creating sub sites, if you are planning to inherit
parent navigation, Managed Navigation doesn’t apply to sub sites
automatically. To resolve this peculiar issue, you must open Navigation
page from sub site settings page and click “OK” for to take in effect.
5) Managed Navigation doesn’t provide open link in new tab.
Structural navigation provide you check box option to open link in new tab. This functionality is not provided in Managed navigation. Though you can overcome this issue with JavaScript patch, you need to put this patch in master page of each site collection to work.
6) Managed Navigation conflict with SharePoint js.
Managed navigation stops working if you explicitly load sp.core.js in your page. The sub level navigation stops populating. I don’t know the strange behavior of it as sp.core.js is SharePoint own js file.
7) Managed Navigation displays additional home tab.
This is not though limitation but its annoying for sure. Managed navigation displays first tab with site name additionally. You can't directly change it or hide it. The thing we need to do with it is mostly hide it with javascript and the bad thing is we need to put that in each and every masterpage.
Thursday, 4 August 2016
SharePoint Exceptions : Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
Issue:
I was trying to delete a task when I was encounter with below error:
Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
I was trying to delete a task when I was encounter with below error:
Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
Code Sample:
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPWeb web = SPContext.Current.Site.AllWebs[new Guid(web guid)]) // this line throws error
{
SPList taskList = web.Lists[new Guid(list id)];
SPListItem _lstItem = taskList.GetItemById(Convert.ToInt32(item id));
if (_lstItem != null)
{
_lstItem.Delete();
}
taskList.Update();
}
});
Reason:
From this site I was able to get reason for this error:
When running inside RunWithElevatedPrivileges, if use SPContext.Current.Site object directly, you will not able to get site object.
Solution:
Instead create a new SPSite object, passing in SPContext.Current.Site.Url.
Code Sample:
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(SPContext.Current.Site.Url)) //add this line
{
using (SPWeb web = site.AllWebs[new Guid(web guid)])
{
SPList taskList = web.Lists[new Guid(list id)];
SPListItem _lstItem = taskList.GetItemById(Convert.ToInt32(item id));
if (_lstItem != null)
{
_lstItem.Delete();
}
taskList.Update();
}
}
});
Reference:
- http://sharepoint.stackexchange.com/questions/27462/unable-to-evaluate-expression-because-the-code-is-optimized-or-a-native-frame-is
- http://frazzleddad.blogspot.in/2011/03/getting-past-sharepoint-exceptions-with.html
Wednesday, 6 July 2016
IIS/SMTP - emails are stuck in mailroot/Queue
Recently I was working on sending mail using smtp server where I stuck on below error:
IIS/SMTP - emails are stuck in mailroot/Queue
Here are few solution that were tried and might help you:
- Check password and username in SMTP server
- Check Pop3 mail setting (require enable) in receiver/ sender mail settings.
- SMTP Virtual Server > Properties > Delievery > Outbound Connections. The option for Limit number of connections to was checked and the value was 20. So it was configured to never make any outbound connections, causing the emails to never leave the server. I unchecked the option and restarted the SMTP server and all was well.
- 'Simple Mail Transfer Protocol (SMTP)' service might be stuck. Try restarting service.
- If you are using SharePoint, check running jobs (Microsoft incoming mail). If its is stuck, run it manually.
- Open IIS 6.0. Right click on SMTP Server Properties. Go to delivery tab on Outbound Connections, fill in TCP Port to 25( if its 587).
Subscribe to:
Posts (Atom)
The "Mark as Decorative" Feature in SharePoint: A Small Toggle With a Big Accessibility Impact
If you've spent any time building pages in SharePoint Online, you've probably noticed a new checkbox tucked inside the Accessibility...
-
In last blog we learn how can we enable footer on SharePoint Online Modern Communication site. If you have not gone through that you can use...
-
If you're managing SharePoint Online environments, there's a significant change on the horizon that you need to prepare for. Microso...
-
Issue : Recently, we had a requirement to sync the calendar between shared mailbox outlook and SharePoint Calendar list. We have created 2 f...













