Tag Info

New answers tagged

0

I presume your ASPX page and Office365 are different (sub)domains Cross-domain iframe requests to SharePoint Online organizations are blocked. https://support.microsoft.com/en-us/kb/2795602 http://blogs.msdn.com/b/officeapps/archive/2012/12/12/iframing-sharepoint-hosted-pages-in-apps.aspx


-1

Open below link in primary WFE server C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\1033\STYLES\Themable\COREV15.CSS Add below style at the end and save #suiteLinksBox {display:none}


0

so? What is rowId? And does it exist on the page. Your code looks fine at first sight. BTW You can achieve the same effect without CSR and JSlink connection in a Calculated Columnn set to datatype=Number with Formula: =[Status] &"<img src=""/_layouts/images/blank.gif"" onload=""{" &"var row=this;while(row.tagName!='TR'){row=row.parentNode}" ...


0

I've had this error too! The way I fixed it was described on a blog by Wictor Wilén. The way he explains it is that there is a token on the SharePoint page that has a timeout. If the token has expired then you can no longer make valid calls. Luckily you can refresh the token at any time UpdateFormDigest(_spPageContextInfo.webServerRelativeUrl, ...


0

The biggest obstacle in doing what you want is that SharePoint 2013 dynamically builds the calendar table on the fly - and it's not a static table like in older versions. Not all of the cells have a class assigned to them, so you end up having to manipulate cells based on their position within the table, or maybe even their position on the page. See if this ...


0

function JSONToCSVConvertor() { var JSONData = JQGridJSON; ReportTitle = "Employee Details"; ShowLabel = true; var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData; var CSV = ''; //Set Report title in first row or line CSV += ReportTitle + '\r\n\n'; //This condition will generate the Label/Header if (ShowLabel) { ...


0

The below code gives the results of the field into a variable called myfield. <script type="text/javascript"> SP.SOD.executeFunc('sp.js','SP.ClientContext',update); var returnedItems; function update(){ var context=new SP.ClientContext(); var list=context.get_web().get_lists().getByTitle('Documents'); var caml = new SP.CamlQuery(); ...


1

The problem was in the event being undefined. IE and Chrome are okay with it, but FF doesn't like it. In the last line, the code should be function(event){Button.OnClick(this, event)


3

The simplest solution is to append ?web=1 at the and of file url Ex: https://server/site/lib/filename.ext?web=1


0

Regarding REST approach: Since you are getting the proper result from GetUserEffectivePermissions endpoint, below is demonstrated how to parse SP.BasePermissions value: var data = { "d": { "GetUserEffectivePermissions": { "__metadata": { "type": "SP.BasePermissions" }, "High": "432", "Low": "1011028583" ...


0

I had two problems. The first was my username The second was trying to parse the result into a Permissions object I was using my login name in the form of domain\user but we're using claims authentication so my user name needed to be i:0#.w|domain\user For example: i:0#.w|stackoverflow\jasonscript Once I corrected the issue with my username, I ...


1

You can obtain the file URL and concatenate with a constant as in the following code: function documentWebUrl(ctx) { var fileUrl = ctx.CurrentItem.FileLeafRef.FileUrl; ExecuteOrDelayUntilScriptLoaded(function () { var clientContext = new SP.ClientContext(); var web = clientContext.get_web(); ...


0

May be something: under IE, getElementById looks for elements by ID and by name, while under FF, it's only by ID. Are you sure your ButtonID element has its ID set to ButtonID and not only its name? If the name attribute has to be used, you may call getElementsByName instead (mind it may return more than one element).


0

In server-side, you may register your custom action (and thus a ScriptLink custom action) on the list itself (see https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.usercustomactions.aspx). I've never done that, but it seems you can do the same with JSOM: see https://msdn.microsoft.com/EN-US/library/office/jj246201.aspx and ...


0

I was adding wrong control source path, Control Id="AdditionalPageHead" Sequence="150" ControlSrc="~/_CONTROLTEMPLATES/UsageReport/SiteUsageActions.ascx" just added /_CONTROLTEMPLATES/15/ solved my problem. Control Id="AdditionalPageHead" Sequence="150" ControlSrc="~/_CONTROLTEMPLATES/15/UsageReport/SiteUsageActions.ascx">


2

There are many ways to get logged in user name SPWeb site = SPControl.GetContextWeb(Context); SPUser user = site.CurrentUser; string strUserName = user.LoginName; or you can use SPWeb web = SPControl.GetContextWeb(this.Context); string userName = web.CurrentUser.LoginName; or you also can use string userName = this.Context.User.Identity.Name;


0

The best options to inject JavaScript in a SPWeb when activating a feature are: Use the SPWeb.CustomJavaScriptFileUrl property (set it from a feature event receiver) Use a Custom Action (see for instance http://www.spdeveloper.co.in/tipsntricks/pages/referencing-js-files-using-custom-action.aspx) Deploy your own custom master page, with the JS code ...


0

In order to include javascript in masterpage, using the code given below: <SharePoint:Scriptlink ID="Scriptlink120" runat="server" name="~SiteCollection/Style Library/JS Path" language="javascript" />. Add this in your master page and then deploy the solution. This shall include the JS file globally which will allow you to use it at all places.


3

You can use JSOM by javascript like two different ways: Using sp.js _spPageContextInfo.userLoginName Or you could use REST function getCurrentUser() { var endpointUrl = _spPageContextInfo.webServerRelativeUrl + '/_api/web/currentuser'; return $.ajax({ url: endpointUrl, method: "GET", contentType: ...


0

Try this: _spPageContextInfo.webAbsoluteUrl + "_api/web/lists/getbytitle('Training Evaluation')/items/?$select=Title,Id,CourseTitle/Id,CourseTitle/Title&$expand=**CourseTitle/Id**&$orderby=**CourseTitle/Id**"


0

You may configure Form Based Authentication (see in the Authentication Providers page for the Web app in CA), and then edit the web.config file (on each WFE) to change the loginUrl property of the <forms> tag to point to your own page.


0

The dialog only takes the URL, it is up to you as a developer what to do with it. I presume you are on 2013 See code at Upload new image in asset library in SharePoint Online Search for Cross-Site Publishing on how to 'sync' your (Asset) Libraries. https://technet.microsoft.com/en-us/library/jj635883.aspx ...


3

After some intense debugging I am answering my own question. And wasted +50 StackOverflow points on this, so am an idiot. I copied and de-minified the original (global) SharePoint RenderGroupTemplate function The relevant lines: b[d+".groupHeader"]=true; a+=spMgr.RenderFieldByName(c,d,b,h); delete b[d+".groupHeader"]; Became: ...


0

As far as I read your requirements then it's out of the box functionality, so no need to write any code. Configure SharePoint to accept logins from the two other domains' ADFS servers (see TechNet: Configure SAML-based claims authentication with AD FS in SharePoint 2013) and it should just work: When users access SharePoint they'll be asked to select ...


0

Here's the final function I ended up using to add the web part: function addWebPart(webUrl, pageUrl,webPartXml,zoneId,zoneIndex, Success,Error){ var context = new SP.ClientContext(webUrl); var web = context.get_web(); var file = web.getFileByServerRelativeUrl(webUrl + pageUrl); var webPartMngr = ...


1

I'm not sure that I fully understand the question (and I don't have enough rep to comment), but it sounds like you could add ?Source=http://URLHERE.com to the end of your URL to redirect. If you already have another parameter set, you'll have to change it to &Source=http://URLHERE.com.


1

You can try: function openModall(pUrl) { SP.UI.ModalDialog.showModalDialog( { url: pUrl, dialogReturnValueCallback: CloseCallback } ); } function CloseCallback(result, returnValue) { if (result == SP.UI.DialogResult.OK) { // some code } else if (result == SP.UI.DialogResult.cancel) { // ...


0

Did you try onclick="window.open('http://msdn.com'); window.frameElement.commonModalDialogClose();"


0

You can use the code given below: Close the popup: $('dialog id').dialog('close'); Provide the id of the popup @ dialog id and check. Redirect to parent window: window.parent.location.herf="http://www.google.com"


0

window.close(); I think you mean redirecting to parent window. If you want to close the current popup window in back end, form/window is the parent. onclick="window.open('http://google.com'); window.close();"


2

Ok, here's what's happening: // select ALL elements that are .block .title h2 span and loop through them $(".block .title h2 span").each(function(index) { // find the length of the text of THIS PARTICULAR element var x=$(this).text().length; // if the length of THIS PARTICULAR element is > 29 if(x > 29) { // change the ...


0

x=$(".block .title h2 span#title").text(); If you have multiple spans then var arrSpanTitles = []; $(".block .title h2 span").each(function(){ arrSpanTitles.push($(this).text()); }); arrSpanTitle will contain all span titles


0

If you get a message like: The 'Attachments' column doesn't exists. Try adding 'Attachments' to the select, like: _api/lists/getByTitle('MyList')/items?$select=Attachment,AttachmentFiles,Title&$expand=AttachmentFiles


2

Yes, it is possible to get it. You can use REST calls to get the required information. The following code shall help you: I have created respective arraylists to store the subsite, document library and folder information. Once the information is collected in the arraylists we can display it as per out requirement. Get subsites: $.ajax({ url: siteUrl + ...


0

This seems to work fine. Haven't tested in IE8 but I think it'll work. function getData(siteurl) { var endpoint = siteurl +"/_vti_bin/ListData.svc/ListName"; $.ajax({ url: endpoint, method: "GET", headers: { "Accept": "application/json; odata=verbose", "Content-Type": "application/json; odata=verbose" }, success: function (data) { //data ...


0

A small change in code and it worked.. <script type="text/javascript"> //var siteUrl = '/projects/'; var oList = null; var web = null; var clientContext = null; function retrieveListItems(sender, args) { var filterValue =document.getElementById("ctl00_ctl41_g_1c91c2d4_fbbb_4792_8507_ba589e5be222_SpListPicker_SelectionBox"); var ...


5

You will need to use $.Deferred() as well as $.when(). Modify appendUserInfo() to be like the following: function appendUserInfo(userId) { var d = $.Deferred(); context.load(items, 'Include(EMail)'); context.executeQuerAsync(function(){ if(items.get_count() > 0) { var item = items.itemAt(0); emailString = ...


0

Once you have retrieved the value form the Date field using JS, use the method "localeFormat()" to convert it to the local time zone and format as desired. Below are a few examples. console.log(targetListItem.get_item('Created').localeFormat()); console.log(targetListItem.get_item('Created').localeFormat("dd/MM/yyyy HH:mm:ss"));


0

You have a capital D on list.getItemByID, it should be list.getItemById https://msdn.microsoft.com/en-us/library/office/jj246019.aspx


4

That should work for you. First it does a Year compare, then reduces a year if the months or days do not align. Edit: The expected Date format is 'YYYY/MM/DD' function Onclick() { var today = new Date(); var birthDate = new Date($("#Text1").val()); var age = today.getFullYear() - birthDate.getFullYear(); var m = ...


1

setFullYear takes 3 parameters for Year, Month , Day Be aware in Javascript Months start at 0 for january, so 11 is december!! Date.setFullYear(year,month,day) If there is no issue to add extra libraries, then add MomentJS, this helps a lot in working with dates. In Can anyone color code a column with an if statement? the javascript Today calculation is ...


0

var serverOffsetTime = ""; function serverDefaultDateTime() { var clientContext = new SP.ClientContext.get_current(); this.timeZone = clientContext.get_web().get_regionalSettings().get_timeZone(); clientContext.load(timeZone); clientContext.executeQueryAsync(Function.createDelegate(this, this.onGetServerOffsetTimeSuccess), ...


1

It was a simple mistake as I assumed, as it is a textbox and not a div, I should use .val instead of .text or html or innerHTML, like this: function Onclick() { var Text1 = $("#Text1").val(); var datetoday = new Date(); var today = datetoday.getFullYear(); var datebirthday = new Date(); datebirthday.setFullYear(Text1); var birthday = ...


0

Please create a method success in your JS file. This arises when JS is not able to find the the specified method. ctx.executeQueryAsync( Function.createDelegate(this, success), Function.createDelegate(this, fail) ); function success(){ // executable lines } function fail(sender,args){ //executable lines }


2

javascripts Date will give you the local time on the client. var now = new Date();


1

After some more analysis, I resolved the code above. Looks like the conversion from SP2010 to SP2013 changed the value the javascript was looking for in the dropDownList. var theSelect = getTagFromIdentifierAndTitle("select","Lookup",fieldName); I changed the Lookup to LookupField and the JavaScript above started working again.


0

easiest way can be..at the background, immediately after page load, save data from these fields in 6 different variables. Now once user clicks on save button, use presaveaction (As u already mentioned) and compare them with current value from the fields and take necessary action. let me know, if this is not clear. More proof full way will be , having ...


0

resetRoleInheritance() method is present in SharePoint 2010 JavaScript client object model and it resets the role inheritance for the securable object and inherits role assignments from the parent securable object. SP.List inherits from SP.SecurableObject Class. Hence resetRoleInheritance() can be called on SP.List object just like breakRoleInheritance. I ...


0

Finally i managed to hide columns(based on the value of another column) in display form by following the below steps: Open SharePoint Designer and create a new display form. Click Home tab(in ribbon) and select "Advanced Mode". In the form,click the field in which you want to check the condition.For eg: Consider the field to be "Status" Now add above the ...


1

I think the reason is that var pictureItem = allLibItems.getById(id); returns a list item, which needs to be loaded first and then executeQueryAsync needs to be called to get the item details in success method.



Top 50 recent answers are included