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

how to change title and bar color

$
0
0

Hi,

how can I change title and bar color highlighted by red color below (text green and bar red color)

thanks


Want some filter while fetching some data in autocomplete .

$
0
0

Hi i am using auto complete. i am showing RequestNo which are fetching from a list .

But i want to filter the data where RequestStatus = Approved or RequestStatus= Rejected.

Right now its fetching all.

Kindly suggest in below code 

function getAutocompleteSource() {


debugger;
var clientContext = SP.ClientContext.get_current();


var oList = clientContext.get_web().get_lists().getByTitle('LAW Review Requests');


var camlQuery = new SP.CamlQuery();


camlQuery.set_viewXml("<View><RowLimit>100</RowLimit></View>");


collListItem = oList.getItems(camlQuery);


clientContext.load(collListItem);


clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));


}




function onQuerySucceeded(sender, args) {


var listItemInfo = "";


var listItemEnumerator = collListItem.getEnumerator();


while (listItemEnumerator.moveNext()) {


var oListItem = listItemEnumerator.get_current();


sArray.push(oListItem.get_item("RequestNumber"));


}


$("#PrevReqno").autocomplete({ source: sArray });


}


function onQueryFailed(sender, args) {


alert("Request failed. " + args.get_message() + "\n" + args.get_stackTrace());


}


Shiv Sharma

Error when updating Managed Meta data by PowerShell

$
0
0

The code breaks on the line:

  $MMSField.SetFieldValue($spItem,$Term)  

below

The error is 

multiple ambuiguos overloads found for SetFieldValue and the argument count:2

Any idea what is wrong? This is supposed to be the standard code.

(This is not a multivalued Taxonomy field)

#Cast to SPListItem to avoid ambiguous overload error
                 $spItem = [Microsoft.SharePoint.SPListItem]$listItem;
                
                 $MMSField = [Microsoft.SharePoint.Taxonomy.TaxonomyField]$spItem.Fields[$FieldName]
                            
 
                  $MMSField.SetFieldValue($spItem,$Term)  


faye fouladi


PowerShell Error while updating a record using Bypasslock method in Powershell

$
0
0

Below is the code:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") | Out-Null
  [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.RecordsManagement.RecordsRepository.Records")
  [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Publishing")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Taxonomy")
$web = Get-SPWeb "http://SharePointdomain/sitess/85bcdccd9204"
#Get Systrem User ID
$sysId = $web.Site.SystemAccount.ID
$sysuser = $web.AllUsers[$sysId]
$token = $sysuser.Token

#Create New Site Object under Token of System Account for the Site Collection
    $newSiteObject = New-Object Microsoft.SharePoint.SPSite($web.Url, $token)
    $newWebObject = $newSiteObject.OpenWeb()

$library = "My Document Library" 

#Create New Site Object under Token of System Account for the Site Collection
#newSiteObject = New-Object Microsoft.SharePoint.SPSite($web, $token)
#w = $newSiteObject.OpenWeb()
$l = $web.Lists[$library] 
$CSVcnt= 0
$items = $list.getItems()  
$listCnt = 0;
Foreach($item in $items){
If($item.ID -eq 127)
 {
   [Microsoft.Office.RecordsManagement.RecordsRepository.Records]::BypassLocks($item, $byPassMethodName)

I am getting the following error:

Execution calling "BypassLocks" with "2" argument(s): value cannot be null.
parameter name: callWithLockingBypassed"
+ CategoryInfo    : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId: ArgumentNullException

How can I fix it please?


Update SharePoint Online List Fields In Different Site Collections via Microsoft Flow

$
0
0
What I'm trying to achieve is when an item is created in a SharePoint Online list located in one site collection, to create that very same item in another SharePoint Online list located in another site collection having the same field values(that I managed to achieve). Then, when that item(the created from the first list one) is modified in the second list that took the entry from the first list, the field values that were updated in the second list to be updated in the corresponding fields for that very same entry in the first list. Any ideas how to achieve the second part? I used Microsoft Flow to achieve the first part.

when i updated any other column, its repeating and apend same values and showing in list version code below.

$
0
0


Hi I am using the following below code but for Getting 2 columns versions from SharePoint list . But when i updated any other column, its repeating/Appending and showing like below image  

function getAllnotesList(requestId){
$().SPServices({
  operation: "GetVersionCollection",
  async: false,
  strlistID: "2A5C55F1-EFF9-46B9-AC00-1325AD325FA8",
  strlistItemID: requestId,
  strFieldName: "InternalWorkerNotes",
  completefunc: function (xData, Status) { 
    $(xData.responseText).find("Version").each(function(i) {// debugger;
    //alert("Name: " + $(this).attr("AdditionComments"));
      internalNotesList.push($(this).attr("InternalWorkerNotes"));
    });  
  }
}); 
}


Shiv Sharma


SharePoint 2013 : How to set workflow Association AutoCleanupDays property for SP 2013 workflow

$
0
0

Hi,

As we know SP 2010 and 2013 workflow behaves differently and have major differences. We have AutoCleanupDays property available for SP 2010 workflow but not for SP 2013 workflow.

We are trying to set the AutoCleanupDays for SP 2013 workflow but do not found any property.

We have tried following code to get the workflow association.

$spurl="<My site URL>"

$web=Get-SPWeb $spurl

$list=$web.Lists["Record Library"];

$wfm=New-object Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager($web)

$sub=$wfm.GetWorkflowSubscriptionService()

$subscriptions=$sub.EnumerateSubscriptionsByList($list.ID)|Where-Object {$_.Name-eq"<My workflow name>"}

$subscriptions.AutoCleanupDays   #not found

Any help is appreciated.

Regards,

Prasad Pathak

How to get any user Department in SharePoint Online using Rest API,SP Services ,JSOM etc

$
0
0

I have User Id in a varibale UserID of any user, OF that user  i want his Department

Note i want only department of the user from his User ID not by his Email Address.

And i have its User Id is in var UserID. Usinf that User Id i need his Department

Thanks & Regards


Shiv Sharma


Creating a page with a list in it using rest api in Sharepoint

$
0
0

Hi experts,

I'm using Sharepoint 2016, so not sure if I can ask this question here as I don't see a specific Forum for 2016 version.

I'm wondering if it's possible to write some client side JS code and call REST APIs to do below from step 1 to step 3:

1. Create a Document Library (let's call it Doc Lib A)

2. Upload some files into Doc Lib A

3. Create a page, add the Doc Lib A in this page, add some links to the page

I can see it's possible to do step 1 and 2, but not sure how to do step 3.. Are there any solutions for this?

Thanks

Why REST API does not give me values in "Name" column?

$
0
0

Hi,

I'm using Sharepoint 2016, I have a Document Library with name "test doc lib", and uploaded some files. The list looks like below,

Now I want to use REST API to get all files in this lib, I put this in the url in Chrome,

http://myrooturl/_api/web/lists/getbytitle('test%20doc%20lib')/items

But in the returned xml data, I don't see the names (e.g. "ToR Update" for the second file).. 

One of the entries returned is like this:

<entry m:etag="&quot;1&quot;">
<id>c07fc9c5-1cbb-478a-9b7b-f610dc932711</id>
<category term="SP.Data.Test_x0020_doc_x0020_libItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" href="Web/Lists(guid'6ced7d41-4480-4a73-85e2-99fff7ae0a4b')/Items(1)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FirstUniqueAncestorSecurableObject" type="application/atom+xml;type=entry" title="FirstUniqueAncestorSecurableObject" href="Web/Lists(guid'6ced7d41-4480-4a73-85e2-99fff7ae0a4b')/Items(1)/FirstUniqueAncestorSecurableObject" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/RoleAssignments" type="application/atom+xml;type=feed" title="RoleAssignments" href="Web/Lists(guid'6ced7d41-4480-4a73-85e2-99fff7ae0a4b')/Items(1)/RoleAssignments" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/AttachmentFiles" type="application/atom+xml;type=feed" title="AttachmentFiles" href="Web/Lists(guid'6ced7d41-4480-4a73-85e2-99fff7ae0a4b')/Items(1)/AttachmentFiles" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ContentType" type="application/atom+xml;type=entry" title="ContentType" href="Web/Lists(guid'6ced7d41-4480-4a73-85e2-99fff7ae0a4b')/Items(1)/ContentType" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/GetDlpPolicyTip" type="application/atom+xml;type=entry" title="GetDlpPolicyTip" href="Web/Lists(guid'6ced7d41-4480-4a73-85e2-99fff7ae0a4b')/Items(1)/GetDlpPolicyTip" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesAsHtml" type="application/atom+xml;type=entry" title="FieldValuesAsHtml" href="Web/Lists(guid'6ced7d41-4480-4a73-85e2-99fff7ae0a4b')/Items(1)/FieldValuesAsHtml" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesAsText" type="application/atom+xml;type=entry" title="FieldValuesAsText" href="Web/Lists(guid'6ced7d41-4480-4a73-85e2-99fff7ae0a4b')/Items(1)/FieldValuesAsText" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesForEdit" type="application/atom+xml;type=entry" title="FieldValuesForEdit" href="Web/Lists(guid'6ced7d41-4480-4a73-85e2-99fff7ae0a4b')/Items(1)/FieldValuesForEdit" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/File" type="application/atom+xml;type=entry" title="File" href="Web/Lists(guid'6ced7d41-4480-4a73-85e2-99fff7ae0a4b')/Items(1)/File" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folder" type="application/atom+xml;type=entry" title="Folder" href="Web/Lists(guid'6ced7d41-4480-4a73-85e2-99fff7ae0a4b')/Items(1)/Folder" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentList" type="application/atom+xml;type=entry" title="ParentList" href="Web/Lists(guid'6ced7d41-4480-4a73-85e2-99fff7ae0a4b')/Items(1)/ParentList" />
<title />
<updated>2019-01-30T20:28:27Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:FileSystemObjectType m:type="Edm.Int32">0</d:FileSystemObjectType>
<d:Id m:type="Edm.Int32">1</d:Id>
<d:ID m:type="Edm.Int32">1</d:ID>
<d:ContentTypeId>0x01010088EBA4AD78FEF3419C77AD257C7DD36C</d:ContentTypeId>
<d:Created m:type="Edm.DateTime">2019-01-30T19:16:50Z</d:Created>
<d:AuthorId m:type="Edm.Int32">10</d:AuthorId>
<d:Modified m:type="Edm.DateTime">2019-01-30T19:48:54Z</d:Modified>
<d:EditorId m:type="Edm.Int32">10</d:EditorId>
<d:OData__CopySource m:null="true" />
<d:CheckoutUserId m:null="true" />
<d:OData__UIVersionString>1.0</d:OData__UIVersionString>
<d:GUID m:type="Edm.Guid">e9b4a53b-d49c-4035-9954-ea4d0f4f3883</d:GUID>
<d:Title m:null="true" />
</m:properties>
</content>
</entry>

How do I retrieve the "displayed values", eg. "1.1 ToR Update", "44 minutes ago" etc?

thanks!

VS 2017, Visual Web Part Project, couldn't add a asmx web reference

$
0
0

Dears, 

I was trying to add .asmx service reference to my visual web part project. The reference is getting added under connected services. Though i cant refer them via the code as i am doing it before.

Envoirnmet : Share Point 2016

VS : VS 2017 Community Edition

kindly help,

thanks,

Ammar

how can i change td value using client side (jquery/javascript)

$
0
0

Hi,

I am using table (bootstrap) to show data like this

I want to change td value highlighted by red box from "renewed" to expired when user click on edit button.

I have ID of table -->  tr like "tr_5" and so on ..

Thanks

Update a Date Time Property Via Powershell for Sharepoint Online

$
0
0

Hello.

Via Powershell, I have created a DateTime field with the SchemaXML below.  It shows the Date and Time on the Field (EventEndDate).   This is exactly what I wanted and I have no problems with this Schema,

$FieldSchema = "<Field Type='DateTime' DisplayName='EventEndDate' Required='FALSE' EnforceUniqueValues='FALSE' Indexed='FALSE'Format='DateTime' FriendlyDisplayFormat='Disabled' StaticName='EventEndDate' ShowInEditForm='TRUE' ShowInNewForm='TRUE' Name='EventEndDate'> </Field>"

My problem is that I have a field called "Event Date", which was previously created to show the Date only (which was the requirement at the time).  I now need that field ("Event Date") to show the "Date and Time".   I have tried to update the "Event Date" to now reflect the "Date and Time" in Powershell (code below), but there doesn't appear to be a valid property to change (for SharePoint Online) and it keeps giving me an invalid cmdlet error.

        #Update the field format (Event Date)
        $field = $list.Fields.GetByInternalNameOrTitle("Event_x0020_Date")
        $field.Format = "DateTime"                        ###this option didn't work
        #$field.DisplayFormat = "DateTime"              ###this option didn't work
        $field.Update()
        $list.Update()
        $context.Load($field)
        $context.Load($list)
        $context.ExecuteQuery()

Any ideas on how I can UPDATE this field (Event Date) to show the Date and Time?

Side note:  It does look like this property can be set with SharePoint on-premise, but we are using SharePoint Online.

Thank you.
Harris

Farm solutions or Add-ins (Onpremise)

$
0
0

Hi

We have an intranet with several site collection that runs on SP 2013 onpremise.
The site collection have custom master pages, page layouts and css. The intranet will continue to operate onpremise (SP2016 or SP2019) in the next few years. So cloud is not an option.
Does it matter to use Farm solution instead Add-ins for the new functionality? Will this cause (using farm solutions) more problems when migrate (SP2016 or SP2019 onpremise) than when I use Add-ins?

Regards,

Ejder

Export SharePoint List items in CSV using powershell

$
0
0

Hello Techies,
I have a requirement to export list data(filtered data) into csv using powershell.

For filtered data, can this done using caml query in powershell ?


How to get the List web part in my page?

$
0
0

Hi,

I created a page, in this page, I placed a button and a list web part. What I want to do is when I click button, I can get the information about the list web part, i.e. the Id or the name of the list. How can I do this?

I'm asking this because there are many such pages, each page has a different list and a button. The button should do similar things just to different lists. So I don't want to hard code the lists in the button's onclick function, so wondering if there's a way to dynamically get the list information in JavaScript.

Thanks,

Michael

Odd PowerShell problem with argument transformation

$
0
0

I am writing a script to create a content type with two variables, a group which is selected from Managed Metadata that mimics our SharePoint Groups, and a user field.

I get the following error (note the second line which checks the type of the argument being passed):

PS C:\Users\facspqadmin> D:\PowerShell\Create-SiteColumns-and-ContentType-SingleProject.ps1
Here we have rootweb Farm Test 3 - the Submittal monster with type Microsoft.SharePoint.SPWeb
Continue (Y/N): y
y
Create-ContentType : Cannot process argument transformation on parameter 'myWeb'. Cannot convert the "System.Object[]" value of type "System.Object[]" to type "Microsoft.SharePoint.SPWeb".
At D:\PowerShell\Create-SiteColumns-and-ContentType-SingleProject.ps1:194 char:36+     $ctypeTeam = Create-ContentType($web,$ctypeParentName,$ctypeName,$ctypeGroup ...+                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo          : InvalidData: (:) [Create-ContentType], ParameterBindingArgumentTransformationException+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Create-ContentType

...and here is a snip of the failing code...

...which is calling the following function...

function Create-ContentType(
    [Microsoft.SharePoint.SPWeb]$myWeb,
    [string]$myParentName,
    [string]$myCtypeName,
    [string]$myCtypeGroup
)
{
    $cTypeParent = $myWeb.AvailableContentTypes[$myParentName]
    $newContentType = New-Object Microsoft.SharePoint.SPContentType($cTypeParent, $myWeb.ContentTypes, $myCtypeName)

    $newContentType.Group = $myCtypeGroup
    $myContentType = $myWeb.ContentTypes.Add($newContentType)

    return $myContentType
}

...any ideas would be most welcome. Baffled as to why it would be trying a transformation from system.object[] which means that it is not understanding the type to begin with; except it is, based on the check prior to passing the argument.

validateupdatelistitem using rest to update User field

$
0
0

I am trying to update user and group field using validateupdatelistitem. But it is not updating as well as not throwing any error in the response.

{'formValues': [{'__metadata': { 'type': 'SP.ListItemFormUpdateValue' },'FieldName': 'Title','FieldValue': 'TesChange'},

{'__metadata': { 'type': 'SP.ListItemFormUpdateValue' },'FieldName': 'UserName','FieldValue': '16'}]

,'bNewDocumentUpdate':true}

In this example I am sending the user id after ensuring the user with login name.

I would like to know what is the correct format to update userfield in validateupdatelistitem withrest api.

Thanks.

Developing Sharepoint apps and web parts with Visual Studio

$
0
0

I'm a SharePoint farm admin with a small production farm, and also two single-server Test/Dev farms, all running SharePoint 2016.

I have Visual Studio 2017, and want to develop some simple custom web parts / apps. Visual Studio is installed on my workstation, and when I try to create a new project, I get the message 'The required version of SharePoint is not installed on this system.'

Does VS have to be installed on the Web front-end server? Can it not connect from a remote location, if the user account has admin privileges on the farms?

Thank you,


Keith Vollero

Poweshell SharePoint BypassLocks attempting to perform an unauthorised operation

$
0
0

I get the following error when I try to run:

Powershell ByPassLocks

Exception calling "BypassLocks" with 2 argument(s) attempting to perform an unauthorized operation.

I am just wondering how I can resolve this?

           $recordsmanagement=[Microsoft.Office.RecordsManagement.RecordsRepository.Records]

                          $ChangeRecord = {
                          param( [Microsoft.SharePoint.SPListItem] $listItem)
                          $MMSField.SetFieldValue($listItem,$spTerm); 
                          $listitem.SystemUpdate() 
                       }

$sysId = $webUrl.Site.SystemAccount.ID
$sysuser = $web.AllUsers[$sysId]
$token = $sysuser.Token
#Create New Site Object under Token of System Account for the Site Collection
$newSiteObject = New-Object Microsoft.SharePoint.SPSite($web.Url, $token)
$newWebObject = $newSiteObject.OpenWeb()
#$item = $newWebObject.GetListItem($fileurl)       

                        #pass the delegate to the By Pass locks API
                        $recordsmanagement::bypasslocks($listItem, $ChangeRecord)

Any idea how this can be resolved?                 


faye fouladi



Viewing all 7589 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>