Tag Info

New answers tagged

1

you can use $().SPServices <script type="text/javascript" src="/sites/sprc/Resources%20%20jQuery/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="/sites/sprc/Resources%20%20jQuery/jQuery%20SP%20Services/jquery.SPServices-0.5.4.min.js"></script> <script type="text/javascript"> function StartWorkflow(ItemURL, ...


1

one way for making sure all 3 levels are expanded <script src="https://portal/SiteAssets/jsLibrary/jquery.1.9.1.min.js" type="text/javascript"></script> $(document).ready(function () { // Wait until SP.JS has loaded before calling expandAll ExecuteOrDelayUntilScriptLoaded(expandAll, "sp.js"); }); function expandAll(){ ...


0

If it were CSOM, you could check the SourceId property (built-in fields have the value http://schemas.microsoft.com/sharepoint/v3 in it), in order to tell whether a field is a built-in or a custom one, like in the following code snippet: SPListItem item = //some code retrieval var customFields = item.Fields.Cast<SPField>().Where(field => ...


0

You can get the value using REST service use following URL format http://SiteURL/_api/web/GetFolderByServerRelativeUrl('Shared%20Documents/fol1/fol2')/Files?$orderby=TimeLastModified desc function FetchAllFiles() { $.ajax({ url:"http://SiteURL/_api/web/GetFolderByServerRelativeUrl('Shared%20Documents/fol1/fol2')/Files?$orderby=TimeLastModified ...


1

Try this var context = new SP.ClientContext.get_current(); var web = context.get_web(); var list = web.get_lists().getByTitle("DocLibrary"); var query = new SP.CamlQuery(); var caml = "<View><Query><OrderBy><FieldRef Name='Modified' Ascending='FALSE' /></OrderBy></Query></View>"; ...


0

SharePoint 2010 introduces a new Ajax option has been added to many webparts to enable auto refresh of webpart without refreshing the entire web page. This feature is available out of the box in SharePoint 2010 and no additional development is required. How to use Auto Refresh Web parts in SharePoint 2010: In SharePoint 2010, web parts have a new section ...


0

SP.UI lives on another file, that is sp.ui.dialog.js You need to add it to the script references <script type="text/javascript" src="_layouts/15/sp.ui.dialog.js"></script>


1

I have used the following javascript to set people pickers on new/edit forms in SP2013: First you need to get the loginName for the user, you could extract the ID from the value you got and use it to get the loginName through a REST query: var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/getuserbyid(" + userid + ")"; $.ajax({ url : ...


0

The problem depends on a lot of details like the authentication configuration of both systems (SP2010 and SP2013) and also the client. If we are talking about Internet Explorer, the authentication is only available within the browser request. That is at least one reason why Microsoft removed the sign in as feature. If you do a sign in as and click on a word ...


1

Take a look at this link http://sympmarc.com/2012/04/22/working-with-sharepoint-people-pickers-with-jquery-a-new-function-called-findpeoplepicker/ And use following code to set picker value siteContactPeoplePicker = $().findPeoplePicker({ peoplePickerDisplayName: "Site Contact", valueToSet: $().SPServices.SPGetCurrentUser() });


0

Don't you have cross-site scripting promlems, when accessing the SP 2013 site from the JavaScript on your SP 2010 page? Regarding your original problem, I inserted the following JavaScript code into a SharePoint 2010 page: $(document).ready(function(){ $.support.cors = true; $.ajax({ url: "http://YourSP2013Server/_api/web/CurrentUser", ...


1

You can use ToolTipTitle and  ToolTipDescription of the Button element in custom action.


0

You can make use of QueryString. So in each link you can format it like http://siteurl/whateverpage.aspx?ItemId=14 Change 14 and dynamically place the Id. Now in your form you can read the query string (using JavaScript or Server Side) and process as required.


0

You can also do: Sys.CultureInfo.CurrentCulture.name Sys.CultureInfo.CurrentCulture is the server CurrentUICulture in JSON. This is created by the page's ScriptManager and to it be available you need to set its property EnableScriptGlobalization to true. I think this is enabled by default in SharePoint.


0

Unfortunately only SharePoint Online CSOM API (v.16) supports those properties currently for List object: List.MajorWithMinorVersionsLimit List.MajorVersionLimit In SharePoint On Premise, you could consider the following approach to return those properties: getListInfo('Documents', function (info) { console.log(info.MajorVersionLimit); ...


1

You can access this information via the MajorVersionLimit and MajorWithMinorVersionsLimit properties of the Microsoft.SharePoint.Client.List object. For example (managed OM): string url = "http://yoursite/subweb"; using (var clientContext = new ClientContext(url)) { var web = clientContext.Web; List list = web.Lists.GetByTitle("YourDocLib"); ...


0

Instead of using radio buttons, you may be able to create a custom list which contains an "options" column as a single line of text and has the two options (Meat and Vegetable) within that list by adding them as items. Then, in the list form, you can have the form pull the "options" column from the custom list you just created through managed metadata. ...


1

The solution I would use instead of populating the options based on the selection would be to create two different fields in a list (meat options and vegetable options). With that you could throw in a simple script on a custom form to show the meat options when the meat radio button is selected and same thing for vegetables. This way all of your ...


0

Finally I found it, apparently this does work but thows an error: this.oListItem = oList.getItemById(1); ctx.load(this.oListItem); ctx.executeQueryAsync( Function.createDelegate( this, function () { console.log("scriptAddMenuToListView.js: AppWebUrl successfully retrieved from lstAppData..."); var xAppWebUrl = ...


0

$('#idHomePageNewItem').click(function(){ var options = SP.UI.$create_DialogOptions(); options.url = $(this).attr('href'); SP.UI.ModalDialog.showModalDialog(options); }); Use above function. Or change html as <a class="ms-addnew" id="idHomePageNewItem" href="#" onclick="javascript:var options = SP.UI.$create_DialogOptions();options.url = ...


0

You can open forms in a modal dialog by using SP.UI.ModalDialog.showModalDialog. Here is the example code given from the site as well: //Using the DialogOptions class. var options = SP.UI.$create_DialogOptions(); options.title = "My Dialog Title"; options.width = 400; options.height = 600; options.url = "/_layouts/DialogPage.aspx"; ...


1

You can use success handler for reading file content function readFileSuccess(data) { alert(data); } Update var executor = new SP.RequestExecutor(weburl); var info = { url: fileContentUrl, method: "GET", binaryStringResponseBody: true, success: function (data) { //binary data available in data.body var result = ...


0

Not sure if it is exactly the same, but I had a similar problem where some JavaScript code in a script editor web part only worked when the page was in edit mode. It started working normally when I added the language and type attributes to the script tags. See this answer.


1

This is happening because of Minimal Download Strategy, which is by default enabled on SP Online. To make it work, you should use SP.SOD.executeFunc https://msdn.microsoft.com/en-us/library/office/ff409592%28v=office.14%29.aspx This ensures that the specified file that contains the specified function is loaded and then runs the specified callback ...


1

You may put your HTML file and its resources in a basic document Library. In SharePoint, any file can be stored in a doc lib, event HTML code, like HTML pages, CSS files or JavaScript code. SharePoint itself stores (some of) its own aspx, CSS files, etc, in document libraries. Once your files are all in the doc lib, clicking on the HTML file would simply ...


1

Use Iframe and reference the -tag to a url in a document library that contains your files yourhtml.aspx, yourjs.js, yourrcss.css. Get your references to scripts and css correct in yourhtml.aspx. Then just: <iframe src="https://yoursharepointurl.com/documents/yourhtml.aspx"></iframe> Use script editor web part, or content editor pointing to a ...


2

The OOTB way to do this would be to create your workflow as you want it and add a stage at the end. In this stage put in a Pause action. You can set this for 1 day (or 24 hours). For your Transition to stage, have it redirect back up to the first stage. The downside of this would be that you have to manually start it that first time. It would also be ...


0

You can use a task scheduling tool such as SQL Server Agent or Windows Task Scheduler and have that execute a PowerShell script that start the workflow. And here is a link to run the workflow in powershell: http://www.thesysadminhimself.com/2013/09/sharepoint-start-workflow-all-items-powershell.html The only other option I can think of is somehow ...


0

Try changing function accordionTemplate(ctx) as follows return "<table border='0' cellspacing='0' cellpadding='0'><tr><td><img src='" + Picture + "' /></td><td><h2>" + title + "</h2><p>" + "Name: " + FullName + "<br /> " + "Phone: " + WorkPhone + "<br /> " + "Email: " + Email+ ...


0

If you have implemented a custom web part then why not set your drop-down value through your C#/VB.net code? I will give you an example of a C# code on how you can change the default value in a drop-down list on page load event. In below code "status" is your drop-down list name. protected void Page_Load(object sender, EventArgs e) { string ...


1

Try this: $(document).ready(function(){ if($("select[title='Status']").find("option:selected").val() == "Choose..") { $("select[title='Status']").val("InProgress"); } });


1

$(document).ready(function(){ if($("select[title='_title of column_'] option:selected").val() == "Choose.."){ $("select[title='_title of column_']").val("In progress..."); } }); not tested, but something like that should do it


2

Since in SharePoint 2013 was introduced Client Side Rendering that represents HTML/JavaScript rendering framework for list views & forms (follow, for example, this article for an introduction), below is demonstrated how invoke a custom code in OnPostRender event: SP.SOD.executeFunc("clienttemplates.js", "SPClientTemplates", function() { function ...


0

You can test the HTML Placeholder where the blog post will append. While it's empty don't do anything. When the content is there, execute your code. Just use a function with a setTimeout that calls itself and that tests if the content arrived. Make sense?


1

Perhaps this will work for you. It's worth a try $(window).load(function(){ //your code } This triggers after everything is loaded according to the jQuery docs. However this does not include asynchronous loading according to the docs below. http://learn.jquery.com/using-jquery-core/document-ready/ Another trick (in SharePoint 2010 at least) is to ...


0

Have you tried this <script language="javascript"> _spBodyOnLoadFunctionNames.push("StartFunction"); function StartFunction() { alert('Init'); } </script> Update function LoadAfterFunction(){ //your code } ExecuteOrDelayUntilScriptLoaded(LoadAfterFunction, "sp.ui.blogs.js")


0

This error typically arises when we try to access a field that was not requested. Try below ctx.load(this.oListItem, 'Include(xValue)');


0

You can use ExcelPlus that permits to deal with Excel in JS and its based on xls-js ... I created it while working on SharepointPlus, a JS library for Sharepoint.


0

Fixed- Just need to set the maximum pixel width for the web part. It appears that when it tries to adjust widths on the fly, this affects the zooming functions.


2

JSOM var listTitle = 'Tasks' var itemId = 1; var fileName = 'Instruction.docx'; var ctx = SP.ClientContext.get_current(); var list = ctx.get_web().get_lists().getByTitle(listTitle); var item = list.getItemById(itemId); var attachmentFile = item.get_attachmentFiles().getByFileName(fileName); attachmentFile.deleteObject(); ctx.executeQueryAsync( ...


0

I doubt about doing this with a excel template but yes there is way to do excel with JSOM it involes of Excel Web Access webparts Check here for more details


1

I have done it using SPServices and it works fine. Below is the code: $().SPServices({ operation: "DeleteAttachment", listName: "List Name", listItemID: itemId, //list item id url: filePath, //url of attachment that needs to be deleted completefunc: function (xData, Status) { console.log('Deleted'); } }); Source you can ...


0

Try following code samples.Any one should work: 1) <script type="text/javascript"> function _spBodyOnLoad() { var PreviousPage = document.referrer.split('/')[3]; if (PreviousPage == "adfs") { var searchString = getQueryStringParameter('site'); PreviousPage=searchString; } var browserName = ...


0

Try this camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name=\'Approval Status\'/><Value Type=\'Text\'>Approved</Value></Eq></Where></Query></View>');


0

Your problem is the field XML, it should look like this: <Field Type="Choice" Name="ApprovalStatus" DisplayName="Approval Status"><CHOICES><CHOICE>Pending</CHOICE><CHOICE>Approved</CHOICE><CHOICE>Reject‌​ed</CHOICE></CHOICES></Field>


0

You can do this using below changes viewInfo.set_viewTypeKind(524288); viewInfo.set_setAsDefaultView(true); //set the view to default For a list of viewTypeKind refer link https://msdn.microsoft.com/en-us/library/office/jj245733.aspx Also in your code you should change context.load(viewcollection); with hostcontext.load(viewcollection);


0

I think your problem is that the variable sublistItems is re-assigned multiple times (in a while loop), so when onFilterQuerySucceeded is called the variable is most likely replaced with another value, which is not yet loaded. One way to solve this is to pass sublistItems into onFilterQuerySucceeded as an argument.


0

Try sample below <script type="text/ecmascript"> var clientContext = new SP.ClientContext.get_current(); var oWebsite = clientContext.get_web(); //Geting reference to the list oList = clientContext.get_web().get_lists().getByTitle('CustomList'); // Get filed collection var fldCollection = oList.get_fields(); var f2 = ...


2

I might be wrong, but isnt Colleagues the same as SPS-Peers? If so you could get it with UserProfiles. Example: function getPeers() { var context = SP.ClientContext.get_current(); var peopleManager = new SP.UserProfiles.PeopleManager(context); userProfileProperties = peopleManager.getMyProperties(); context.load(userProfileProperties, ...


1

Unfortunately it does not seem possible to archive via SharePoint CSOM/JSOM API since SSOM ColleagueManager class is not supported in CSOM/JSOM API. But you could utilize SharePoint Web Services, in particular UserProfileService.GetUserColleagues method for that purpose: SPServices example: $().SPServices({ operation: "GetUserColleagues", ...



Top 50 recent answers are included