Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all 7589 articles
Browse latest View live

Update term set display name via code

$
0
0

Hi All

I have a list, when user creates a new item I am creating new term set by calling below code on PreSave :

function CreateTerm(key, value)
        {   
            try{
            var dfdZ = $.Deferred();
            if (iscreated )
            {
                iscreated = false;
                var context = SP.ClientContext.get_current();

                //defines current Taxonomy Session
                var taxSession = SP.Taxonomy.TaxonomySession.getTaxonomySession(context);

                //Term Stores
                var termStores = taxSession.get_termStores();

                //get the Termstore by Termstore name
                var termStore = termStores.getByName("Taxonomy_bJik8sNfJ/Yz3Z2wP+SPHg==");

                    var guid= key;
                    var termname = value;
                    var termSet = termStore.getTermSet(guid);
                    var newguide =CreateGuid() ;
                    var newTerm = termSet.createTerm(  termname, 1033, newguide);

                    context.load(newTerm);
                    context.executeQueryAsync(function () {
                    iscreated = true;
                    dfdZ.resolve(iscreated);

                }, function (sender, args) {
                    console.log(value + " termname already exist " +  args.get_message());
                    iscreated = true;
                    dfdZ.resolve(iscreated);
                });
                return dfdZ.promise();
            }
            else
                {
                    setTimeout(function(){
                        CreateTerm(key, value)
                        }, 2000);
                }
            }
            catch(error)
            {
                console.log('Error: '+error);
            }
        }

    function CreateGuid() {  
        function _p8(s) {  
            var p = (Math.random().toString(16)+"000000000").substr(2,8);  
            return s ? "-" + p.substr(0,4) + "-" + p.substr(4,4) : p ;  
        }  
        return _p8() + _p8(true) + _p8(true) + _p8();  
    }

And when user edits the item, I need to edit the display name of term set dynamically. I am unable to figure out how this can be done.

Please help.



Thanks in Advance, Jiniv Thakkar


Executing JavaScript after a Modal Dialog has opened

$
0
0

I am trying to run a script that needs to look at elements inside of a modal dialog. What I am running into is the script is loaded BEFORE the modal dialog is opened and when I click my button to open it, the modal page isn't displayed correctly. What do I do to load JavaScript AFTER the modal has been opened?

Thanks!

how can set the selected text of dropdown field on NewForm.aspx based on querystring?

$
0
0

I need to set the selected value of a dropdown field on my list newform. The value is being passed to the page by a querystring. I am able to retrieve it and it matches one of the options of the dropdown. How do I programmatically set the dropdown field to this text please?

Thanks


faye fouladi

how to take backup of office 365 sharepoint 2013 online site with including its subsites?

$
0
0

hello Friends,

I have created Top level site and its 5 subsides on share point 2013 online office 365 site.

I created on  test environment but now this backup move to Production environment so i  try take a backup of top level site with including  its subsides in one .wsp package.But its no happening when i save top level site save as Template including content it contain its list and library but not Subsides .

What are the way to take back including Subsides.

Thanks

Siddheshwar

PowerShell to Cancel SharePoint Online Workflow for Document Library

$
0
0

We have a SharePoint Online document library with a workflow name "TestWorkflow" and few hundred documents are running this workflow.  I need to cancel all running workflow with "TestWorkflow" column show "In Progress".  We need PowerShell to run and cancel all the workflow with above criteria.

I found few articles using PowerShell using CSOM to cancel workflow

1. https://www.sharepointdiary.com/2018/05/sharepoint-online-terminate-workflow-using-powershell.html

2. http://abhilashjourney.blogspot.com/2016/10/cancel-workflow-for-particular-list.html

3. https://en.rapidcircle.com/news/powershell-terminate-a-workflow-for-all-items-in-a-list-on-sharepoint-online

4. https://social.msdn.microsoft.com/Forums/sqlserver/en-US/f6067af2-8cd0-42e3-a8b9-639cd38d433f/stop-all-the-running-workflows-on-a-list-using-spservices?forum=sharepointcustomizationlegacy

dfds

For some reasons, all above article code does not work for current SharePoint Online 2019.  My SharePoint online document library have 3 records and when the PowerShell code run, it show no workflow found and hence did not cancel any workflow where it "In Progress".

Please help.

Thanks

Tee

SP List form textbox Jquery autocomplete display & for '&'

$
0
0

I am able to auto populate SPlist textbox via script editor webpart. The only problem is & displays &

I tried using escape multiple ways but it still displays ampersand encoded. Will you please help?

var baseServiceUrl = 'http://spservice.portal.com/';
    $("#selectCompanyName").autocomplete({
                minLength: 2,
                source: function (request, response) {
                    $.getJSON(baseServiceUrl + '/serviceProvider/contact/name/' + request.term + '/?callback=?',
                        {
                            contextKey: function () {
                                // applies to associated parties
                                var key = $(this).parent().parent().find('.type').val();
                                if (key !== "--Select--" && key !== "")
                                    key = key === "O" ? "Company" : "Company";
                                else
                                    key = "";

                                return escape(key);
                            },
                            format: "json"
                        },
                        function (data) {
                            response($.map(data,
                                function (item) {
                                    return {
                                        label: item['Company'],
                                        value: item['Company']
                                    }
                                }));
                        },{ escape: false }).sort();
                }
               
    });

Get All Terms from Term Set

$
0
0

Hi Experts,

I want to get all terms from a specific Term Set, I'm using SharePoint Online and want to get the Terms name, better to use CSOM.

Can any one help me ?

Thanks in advance.

Maximum List Items returned by REST API

$
0
0

Hi everyone,

Have any link Guide desc about Max response item returned from API.

I checked around but still not find link desc clear about it.

Please help me if you have any info related?

Thank a lot,

Danh



acces requests eraser

$
0
0

Hi all,

Is there a way to purge/erase all of acces requests (without sending notifications) ?

In the box ? In powershell ?

Regards,

Elmata

Change a user group permission in SharePoint with Rest

$
0
0

I'm doing a function which can update a group with different permission level, can this be done with Rest or Jsom ?

I'm using SharePoint Online.

SharePoint online I am not able to hide the page title when opening in Modal dialog

$
0
0

Please advise me as to how to hide the page title (shown in the attached screenshot as SendManualEmail) using Jquery. I have tried the following with no sucess.

 <style>

body div.ms-dlgBorder div.ms-dlgTitle
{
    display:none;
}   

</style>

 

 $( document ).ready(function() {
  $('#pageTitle').remove();
  document.querySelector("#pageTitle").style.display = 'none';
  document.getElementById('dialogTitleSpan').style.visibility = 'hidden';


});


faye fouladi

How to load up 5 lists on page load fast

$
0
0

I have a requirement that I need to retrieve listitems from 5 different lists when the page loads up on screen. The JavaScript functions I am using all return data asynchronously. How can I make sure that everything runs and it is fairly fast?

Thanks


faye fouladi

Can't get Search Results with “Complete Matching”

$
0
0

Good day,

I have the task to create custom search results page for existing list.

The “Title” field in this list can have values like “8841271.050-2017”, “89-11.05-17”, “8841271.082-2019” and another numbers separated by characters “-”,”.”,”/”

I created custom SharePoint Advanced Search Web Part and added property restrictions “Title”.

The Search by Title works fine. But the users can’t understand Search Results.

For example, if they try to find the documents where “Title” contains “030”, the Search Results return documents with “Title” contains “030” and documents with “Title” contains “30”…

For example, one document has Title “8841271.030-2017” and another document has Title “40/276/30-6-1” in Search Results. It doesn’t look right for users.

To correct this I opened «Title» managed property, but the option “Complete Matching is unavailable for it.

I created DocTitleISM managed property similar “Title” managed property with “Complete Matching” option selected.

I created new template for element displaying.  In my custom Search Results template

<mso:ManagedPropertyMappingmsdt:dt="string">'Title':'DocTitleISM',…….</mso:ManagedPropertyMapping>

<td ms-vb2"  >

<div>

_#=ctx.CurrentItem.DocInvNumISM=#_

</div>

</td>

My next actions:

  1. Edit the Advanced Search page
  2. Edit the Advanced Search Box webpart
  3. In the webparts toolbox, expand the Properties section
  4. Copy the text in the Properties textbox to a notepad editor and change it

<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <PropertyDefs>

  <PropertyDef Name="DocTitleISM" DataType="text" DisplayName="Document Title"/>

  </PropertyDefs>

  <ResultTypes>

  <ResultType DisplayName="All Results" Name="default">

  <KeywordQuery/>

  <PropertyRef Name="DocTitleISM" />

  </ResultType>

  </ResultTypes>

  </root>

  1.  Copy the XML back into the Properties textbox in the webparts toolbox pane
  2.  Apply the changes to the Advanced Search Box webpart.

But I can’t get any Search Results if I use my DocTitleISM managed property. Maybe I have made some mistake in my manipulations and new managed property doesn’t work?

Correct me, please

Need a Formula to Use to Extract Month and Year from Date Range

$
0
0

Hi

I have a SharePoint list that has a Start Date and an End Date column.  I also have a set of columns, one for each month of the year.  I'm looking to make these calculated columns to that if, say, the first column "Jan 20" is contained within the Start Date and End Date range then make the value for the "Jan 20" column "Yes."

So, for instance, if there is a list item with a start date of 1/15/2020 and and end date of 3/20/2020, then the calculated columns "Jan 20", Feb 20", Mar 20" will all have a value of Yes, while all of the remaining calculated columns have a value of "No."

Thanks so much for your help!

Automatic resize of Client Web Part height

$
0
0

My app for SharePoint Online is a Client Web Part which will have dynamic content. I've tried various code samples that get the Sender ID and set the height and width of the IFrame, the problem is it only works for the width. If I set a fixed height it works but I need the height to be 100% as setting a fixed height renders my app useless. I've spent too much time trying to get what I thought would be an easy fix to find out it's possibly not doable?!?

Here's what I'm doing to try and fix this issue:

<script type="text/javascript">"use strict"; window.iFrameResize = window.iFrameResize || {}; $(document).ready(function () { iFrameResize.Part.init(); }); iFrameResize.Part = { senderId: '', init: function () { var params = document.URL.split("?")[1].split("&"); for (var i = 0; i < params.length; i = i + 1) { var param = params[i].split("="); if (param[0].toLowerCase() == "senderid") this.senderId = decodeURIComponent(param[1]); } this.adjustSize(); }, adjustSize: function () { resizeMessage = '<message senderId={Sender_ID}>resize({Width}, {Height})</message>';

resizeMessage = resizeMessage.replace("{Sender_ID}", this.senderId); resizeMessage = resizeMessage.replace("{Height}", "100%"); resizeMessage = resizeMessage.replace("{Width}", "100%"); window.parent.postMessage(resizeMessage, "*"); } };</script>



Disable/Hide Delete Document option in SharePoint Ribbon for a Document Library

$
0
0

Hi,

I tried getting the ID of Delete Document Button on Ribbon and tried to Hide it. Unfortunately not able to hide it. Any Suggestions would be helpful.

Code that I have tried:

    

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">

$(document).ready(function(){

$(document.getElementById('Ribbon.ListItem.Manage-LargeMedium-1-2')).addClass('ms-cui-row ms-cui-disabled');
}); </script>

also tried 

<script type="text/javascript">
    
$(document).ready(function(){

$('a[id*="Ribbon.ListItem.Manage.Delete-Medium"]').hide();
}); </script>

How to read provisioning template xml values into CSOM in SharePoint online Azure function

$
0
0

I have a PnP provisioning XML template as shown in below.

-------------------------------------------------------------------------------------------------------------------------------------------

<?xml version="1.0"?>

-<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2019/09/ProvisioningSchema">

<pnp:Preferences Generator="OfficeDevPnP.Core, Version=3.14.1910.1, Culture=neutral, PublicKeyToken=5e633289e95c321a"/>


-<pnp:Templates ID="CONTAINER-TEMPLATE-8A98801966044DD78F79DAB46AE2E0BE">


-<pnp:ProvisioningTemplate ID="TEMPLATE-8A98801966044DD78F79DAB46AE2E0BE" Scope="Undefined" Version="0">


-<pnp:ClientSidePages>


-<pnp:ClientSidePage LCID="0" PageName="98B3B38A52805CAB.aspx" ThumbnailUrl="" Title="Manage Project Portfolio" Overwrite="true" PromoteAsTemplate="false" PromoteAsNewsArticle="false">

<pnp:Header AuthorByLineId="-1" AuthorByLine="["i:0#.f|membership|chandan@vgmsid.onmicrosoft.com" ]" Authors="[{"id": "i:0#.f|membership|chandan@vgmsid.onmicrosoft.com","upn": "Chandan@vgmsid.onmicrosoft.com","name":"Chandan Sahani","role": ""} ]" AlternativeText="" TopicHeader="" ShowPublishDate="false" ShowTopicHeader="false" TextAlignment="Center" LayoutType="FullWidthImage" ServerRelativeImageUrl="{site}/SiteAssets/SitePages/98B3B38A52805CAB/4096-TopBackground.PNG" Type="Custom"/>


-<pnp:Sections>


-<pnp:Section Type="TwoColumnLeft" Order="1">


-<pnp:Controls>


-<pnp:CanvasControl Order="1" Column="1" ControlId="3e47fe13-9deb-4d11-9b3b-377732da53f8" WebPartType="Text">


-<pnp:CanvasControlProperties>

<pnp:CanvasControlProperty Value="<div> <div> <div> <div> <div> <h2>Purpose</h2> <p>Securing and optimizing the execution of the product- and technology project portfolio plan as well<br> as the maintenance plan.</p> </div> </div> </div> </div> </div> " Key="Text"/>

</pnp:CanvasControlProperties>

</pnp:CanvasControl>

</pnp:Controls>

</pnp:Section>


-<pnp:Section Type="OneColumn" Order="2">


-<pnp:Controls>


-<pnp:CanvasControl Order="1" Column="1" ControlId="2a718f4b-4754-45c9-bade-65e991fff3b9" WebPartType="Text">


-<pnp:CanvasControlProperties>

<pnp:CanvasControlProperty Value="<div> <div> <div> <div> <div> <h2>Description</h2> <div>Monitor the execution of the product- and technology project portfolio plan as well as the maintenance plan.</div><div>Track deviation that occurs during the year and find the best solution to solve it.</div> <div>Prepare and initiate all new projects.</div> <div>Manage Project Portfolio training material can be found here:<span>&nbsp;</span><a href="http://phoenix.volvogroup.net/phoenix/encrypt/encrypt?method=4EC453628079380EE16144D1C31BA31692B0C0FD0DD004413768D409F606D46865BB9B2B1A10F88E0FAAC40D2C5A3559"><b><u>Manage Project Portfolio training material</u></b></a></div></div> </div> </div> </div> </div> " Key="Text"/>

</pnp:CanvasControlProperties>

</pnp:CanvasControl>

</pnp:Controls>

</pnp:Section>

</pnp:Sections>

</pnp:ClientSidePage>

</pnp:ClientSidePages>

</pnp:ProvisioningTemplate>

</pnp:Templates>

</pnp:Provisioning>

---------------------------------------------------------------------------------------------------------------------------------------

How can i read the "pnp:CanvasControlProperty " value that is "Purpose" from the above XML using CSOM code by using azure fucntion

Time Validation is not working properly.

$
0
0

Time validation is not working properly

                                         

But When i entered 9:59 AM PickUp Time and Drop Time 11:15AM then its not validating properly. As i validate drop time should be greater, But i already select greater time 11:15AM 

$(function () {  
                $('#pickTime').datetimepicker({
ignoreReadonly: true,
                    format: 'LT'
                });
            });

   $(function () {
                $('#drpTime').datetimepicker({
                ignoreReadonly: true,
                    format: 'LT'
                });
            }); 

 if(pickTime>=drpTime && CheckPickUp=="Yes" && CheckDropUp=="Yes" &&  drpTime!="" && varPickDate >= varDrpDate)
            {
              isValid = false;
              $('#drpTime').after('<div class="error">Drop time should be greater than pickup time</div>');
            }

HTML:-

<div class="row">
                                                <div class="col-md-12">
                                                    <div class="col-md-4">
                                                        <div class="form-group">
                                                            <label for="traveller-name"><b>
Time  <span class="ast">
*</span></b></label>
                                                        </div>
                                                    </div>
                                                        <div class="col-md-4" id="divpickTime">
                                                             <div class="form-group">
                                                          <input type="text" id="pickTime" readonly="readonly"  class="form-control"/>                                                        
                                                                
                                                    </div>
                                                            </div>
                                                    <div class="col-md-4" id="divdrpTime">
                                                            <input type="text" id="drpTime" readonly="readonly"  class="form-control input-small"/>
                                                          
                                                                
                                                    </div>
                                                </div>
                                            </div>


Shiv Sharma

how to update a People group field in SharePoint list with a given SharePoint group

$
0
0
I have a requirement that I need to update a field in my list item (upon creation with the value of a SharePoint group stored in another list. How can I accomplish this either using SharePoint designer or JavaScript please?

How can I utilize the code below to insert value of a given SharePoint group into a field using Ajax:

function updateFileMetadata()
{
    ro = new SP.RequestExecutor('https://mysiteurl');
    var info = {
        url: "_api/web/GetFolderByServerRelativeUrl('documentlibraryurl')/Files/getbyurl(url='" + currentFileName+ "')/listitemallfields/validateupdatelistitem",
        method: "POST",
        body: JSON.stringify({
            'formValues': [
                {
                    '__metadata': { 'type': 'SP.ListItemFormUpdateValue' },
                    'FieldName': 'fieldname1',
                    'FieldValue': value1
                },
            {
                '__metadata': { 'type': 'SP.ListItemFormUpdateValue' },
                'FieldName': 'FieldName2',
                'FieldValue': value2
            },
            {
                '__metadata': { 'type': 'SP.ListItemFormUpdateValue' },
                'FieldName': 'PersonOrGroupField',
                'FieldValue': Value3
            }
            ],
            'bNewDocumentUpdate': true,
            'checkInComment': ''
        }),
        'headers': {
            'accept': 'application/json;odata=verbose',
            'content-type': 'application/json;odata=verbose',
        },
        success: mysuccessfunction,
        error: myErrorfunction
    };
    ro.executeAsync(info);

}


i want to create additional page properties in site pages in SharePoint online

$
0
0
i want to create additional page properties in site pages in SharePoint online and i want to update data pf new page properties how can we achieve this?
Viewing all 7589 articles
Browse latest View live