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

"The SPListItem being updated was not retrieved with all taxonomy fields." Exception while updating a taxaonomy field

$
0
0

Hi All,

I'm getting this exception "The SPListItem being updated was not retrieved with all taxonomy fields." when i try to programatically update a taxonomy field of a list item. Can any1 pls tell me why this exception occurs ???


If statement for RAG statement

$
0
0

Hi,

I have an aging column in sharepoint, that I would like to reflect show RAG (Red, Amber and Green) status based on the amount of days each case has aged.

Aging<15 Green

Aging >=15<30 Amber

Aging >=30 Red

Status can just display words "Green", "Amber" and "Red".

What would be the if statement to achive this?

Injecting HTML (or XML) into a Word Template from SP List

$
0
0

This is probably the simplest question ever put forward in this forum

What I basically want to do is put data a couple of SP lists into a report. The report will be put into a Word template.

All the programmatic action is in JavaScript

My approach is to use REST requests to pull all the data needed from the lists.  This is then constructed into an HTML (or XML?) string which will fill into a placeholder into the Word template.

I am not sure if the approach is actually to construct the Word file and then have Word open it as the desktop application (modifying the HTML and CSS to get it looking right in Word).

Or whether to save an HTML (or XML?) fragment as file. then have Word open it, with Word JavaScript (not VBA) then initializing to import it to a placeholder within the Word template.

It would be also nice to know that in opening Word from JavaScript in SP, what the URL can contain within it to instruct the Word application as what to do, if Word takes cues from URLs.

What does it exactly validates: currentUser.get_isSiteAdmin()?

$
0
0

Hi,

I am working on a Project which has a lot of groups and different subsites. For some reason, for some users I am getting this code as false:

 currentUser.get_isSiteAdmin()

What this get_isSiteAdmin() method exactly validates?

If you are and Admin do you have to belong to an exactly groups or some special permission?

Thank you! Please, if its possible show me some image where I set a user as Admin with SP Designer or Web site? or how can I validate manually one user is an admin?




What does it exactly validates: SP.User.get_isSiteAdmin()?

$
0
0

Hi,

I am working on a Project which has a lot of groups and different subsites. For some reason, for some users I am getting this code as false:

 currentUser.get_isSiteAdmin()

What this get_isSiteAdmin() method exactly validates?

If you are and Admin do you have to belong to an exactly groups or some special permission?

Thank you! Please, if its possible show me some image where I set a user as Admin with SP Designer or Web site? or how can I validate manually one user is an admin?





Why is not getting all groups using SP.User.get_groups()?

$
0
0

Hello I am working with JSOM on SharePoint Server 2016.

I am trying to execute this code:

    var clientContext = new SP.ClientContext.get_current();
    var oWeb = clientContext.get_web();
    var currentUser = oWeb.get_currentUser();
    var allGroups = currentUser.get_groups();
    clientContext.load(allGroups);
    var groups = new Array();
    clientContext.executeQueryAsync(function () {
        vargrpsEnumerator = allGroups.getEnumerator();
        while(grpsEnumerator.moveNext())
        {
            vargroup = grpsEnumerator.get_current();
            groups.push(group.get_title());
        }
    }, function (sender,args) {
    
    });

For some reason the method get_groups() does not retrieve all the groups. When I execute using console it retrieves all records, but is not the same result when it is executed from Javascript file.

What is the workaround or solution?

Thank you!

Linq query to Get Data between two Dates

$
0
0
<
  • Hi All,

    I'm Fresher in C# asp.net, I have two dates (*05/01/2013 and *05/04/2013) in Text Feild.

  •       When I give value this date in text Fei I need to fetch the items from List between these two dates and Pass the Data to crystal report using C# MVC Form 

    Can Any one help me how can I do this


    Darshan Kumar


Using caml query to get items

$
0
0

Hi all,

I have a requiremnt like i want to add users to sp group in multiple sitecolls.All site collections are stored in a list.I need a caml query to get first 10 sitecolls then i need to get next 10 sitecolls and then i need to get 10 sitecolls from list.Then i will add one by one.Please help me how to achieve this.

Regards,

Praveen


get the group id by pasisng groupname csom sp 2010

$
0
0

Hi all,

I want to get the group id by passing the groupname in sharepoint 2010 csom.I dont have option to pass groupname using context.web.sitegroups.getbyname in sharepoint 2010 csom.please help me on this.

Thanks in advance.

regards,

Praveen

Powershell with menus for updating all items or certain items with values

$
0
0
How can I implement a powershell with menus to select for updating all or selected items to update for some fields?



Sharepoint 2010 site not opens in other machine's IE browser

$
0
0

Sharepoint 2010 Dev machine: Have a MysiteHost site collection and opens fine in IE and chrome.

if i access the same site in other machines, it is not opening in IE (but opens in chrome)  It asks for credentials but at the end shows only blank page. No error message in F12 developer tools.

Since I cannot change any IE settings, is there any way to make it work in IE?

Export sharepoint pages to XML using powersehll Online

$
0
0

Hi All,

I want to export all pages from page library SharePoint online site using power shell.

Can any one help me with this request. I have written code upto get the pages now i want to export as xml to local system folder.

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")

Function New-Context([String]$WebUrl) {
    $UserName = "test1.raju@test.onmicrosoft.com";
    $SecurePassword = "PASSWORD" | ConvertTo-SecureString -AsPlainText -Force
    $context = New-Object Microsoft.SharePoint.Client.ClientContext($WebUrl)
    $context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword)
    $context
    $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword)
}

Function Get-List([Microsoft.SharePoint.Client.ClientContext]$Context, [String]$ListTitle) {
    $list = $context.Web.Lists.GetByTitle($ListTitle)
    $context.Load($list)
    $context.ExecuteQuery()
    $list 
}

$context = New-Context -WebUrl "https://rert.testsite.com/"
$list = Get-List -Context $context -ListTitle "Pages"

$query = [Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery()
$items = $list.GetItems($query)
$context.Load($items)
$context.ExecuteQuery()

$items.Count

foreach($item in $items)
{
 // getting all pages here now i need to export as xml to localfolder.
}

$context.Dispose()



Check if Parent Folder contains more than 1 document and then delete particular document from that folder in SharePoint 2013 CSOM

$
0
0
I want to delete document with name 'Test' in CSOM. this document is present in subfolder. whereas code should delete this document only if its parent folder(i.e subfolder) has more than 1 document. I know I can use CAML Query to get all documents with 'Test' name and then iterate it to check if its parent folder has more than 1 document and then delete this document. But I can not use this method as it will make more calls to SharePoint(5000 calls for 5000 listItems to get parentFolder files count). Please let me know if you guys have any other idea. SharePoint version is SharePoint 2013 onpremise.

Vishal

Upgrade legacy application to support TLS 1.2 with SharePoint 2010

$
0
0
We have a legacy ASP.NET application developed with .NET Framework 2.0 and SharePoint 2010 running on Windows Server 2008 R2 SP1. We would like to upgrade the application to support TLS 1.2. The application solution consists of 3 projects, one project for communications, one project sharing a common library and another project for a SharePoint portal. We attempted to upgrade the application to .NET Framework 4.6.1. using Visual Studio 2015.

After upgrading the solution to Visual Studio 2015, the "Target framework" changes to "4.6.1" for the communications project and the common project. But the SharePoint project, which referees SharePoint assemblies, remains as "3.5". There are no newer versions available in the drop-down menu to select. We assume that this is because SharePoint 2010 uses .NET Framework version 3.5 SP1 .NET Framework support in SharePoint 2010 – SharePoint dev ... However, it seems that .NET Framework 3.5.1 can also support TLS 1.2 Support for TLS System Default Versions included ... - Microsoft Support.

It seems that we have at least two options to make our legacy application to support TLS 1.2, without upgrading SharePoint 2010:

  1. Separate the communication project into a Web Service with .NET Framework 4.6.1 which supports TLS 1.2. The original application will contain the rest two projects with .NET Framework 3.5 and the application will consume the Web Service.
  2. Follow the instruction in Support for TLS System Default Versions included ... - Microsoft Support and update the application to support TLS 1.2 with SharePoint 2010.

Is the option 2 possible? Has anyone had experience with it? What are your suggestions for the solution?

Thank you,

Yong

Update Content of the web part using power shell for share point online.

$
0
0

Hi All,

I want to update the content of the web part with (XML File: which is already exported from one content editor file)

In power shell online there is no Property of Webpart.content. what is equalent property in online to update it?

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")

Function New-Context([String]$WebUrl) {
    $UserName = "testi@test123.onmicrosoft.com";
    $SecurePassword = "PASSWORD" | ConvertTo-SecureString -AsPlainText -Force
    $context = New-Object Microsoft.SharePoint.Client.ClientContext($WebUrl)
    $context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword)
    $context
    $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword)
}

Function Get-List([Microsoft.SharePoint.Client.ClientContext]$Context, [String]$ListTitle) {
    $list = $context.Web.Lists.GetByTitle($ListTitle)
    $context.Load($list)
    $context.ExecuteQuery()
    $list 
}

$context = New-Context -WebUrl "https://test.sharepoint.com/sites/testPortal/"
$list = Get-List -Context $context -ListTitle "Pages"

$query = [Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery()
$items = $list.GetItems($query)
$context.Load($items)
$context.ExecuteQuery()

$items.Count

foreach($item in $items)
{
       
        $XMLFilePath="C:\test\testfile\"+$item["Title"]+".xml";
        $URL= $item.Context.Url+"Pages/"+$item["Title"]+".aspx"
        write-host $URL;
        $page = $Context.Web.GetFileByUrl($URL)
        $Context.Load($page)
        $Context.ExecuteQuery()
        $webpartmanager = $page.GetLimitedWebPartManager([Microsoft.Sharepoint.Client.WebParts.PersonalizationScope]::Shared)
        $Context.Load($webpartmanager)
        $webParts = $webpartmanager.WebParts
        $Context.Load($webParts)
        $Context.ExecuteQuery()   
        #Create Root Elemment "pages"
        foreach($webpart in $webparts)     
	    {  

          
         $NewWebPartXml = get-content $XMLFilePath 
         $webPartXmlWP = $webpartmanager.ExportWebPart($webpart.Id)
         $Context.ExecuteQuery()
         $OldContentXml=$webPartXmlWP.Value;

         #$XmlDoc = New-Object System.Xml.XmlDocument
         #$NewContentXml= $XmlDoc.CreateElement("Webpart")
         #$NewContentXml.InnerText= $OldContentXml.Replace($OldContentXml, $NewWebPartXml)
           #write-host $NewContentXml.InnerText;

          #Set content and Save
          #$webpart.Content = $NewContentXml;    
          #$webpart.SaveWebPartChanges();

          
                   
           $Context.Load($webpart.WebPart.Properties)
           try
           {
           $Context.executeQuery()
           write-host $webpart.WebPart.Properties.
           }
           catch
           {
           write-host "Error: $($_.Exception.Message)" -foregroundcolor red
           }
           $webpart.WebPart.Properties["Content"]=$NewWebPartXml;
 ====Here i am getting error====================
           $webpart.SaveWebPartChanges();
		   $Context.executeQuery()       
		}
}


$context.Dispose()










Connect Visual Stedio via sharepoint site and internet URL

$
0
0

hi

i use power shell to create sitecollection cmd with set internet domain http://xxxx.com

# Parameters
$webAppHostHeader = 'http://portal'
$webAppName = 'Portal'
$webAppOwnerAlias = 'SHAREPOINT20190\administrator'
$siteColOwnerAlias = 'SHAREPOINT20190\administrator'
$rootSiteTemplate = 'BLANKINTERNET#0'

# Create the site collection1
New-SPSite 'http://xxxx.com' -HostHeaderWebApplication $webAppHostHeader -Name 'StartWebsite Website' -Description 'StartWebsite Website' -OwnerAlias $siteColOwnerAlias -Language 1033 -Template $rootSiteTemplate

Now URL Site is 'http://xxxx.com' How i can Connect this site with Visual Stedio

Problem Is Url 

Regular expression validation only numbers with 10 numbers

$
0
0

HI All

I am facing a new issue and my requirement is in textbox i need to 10 numbers with comma and along wit 2 decimal characters.

like this 1,234,567,891.67.i tried alot of examples can you give any suggestions plx or code plz

Reagrds

jai


jayendra

Update content editor using powershell

$
0
0

Hi All,

I want to load HTMl file from local system and update that content to content editor webpart using powershell.

Please help me on this?

Moving a list with a name changes to System Account

$
0
0

I am using SharePoint 2010 and I have a list with has an "Assigned To" column defined with Type Person or Group.

This list is in a site which is being redesigned and I need to move this list to another SharePoint site.
When I move older items from this list, if the "Assigned To" has the name of a person which is no longer in our Active Directory, the name is replaced with System Account.

How can I move the list and retain the names of people no longer with the company?

Thanks,
Terry

Is there any possibility to read that UniqueId from sharepoint 2010 server?

$
0
0
I would like to read some folder- and file-properties from sharepoint 2010 server. The most important property is the UniqueId. Is there any possibility to read that property?

I tried with csom (Microsoft.SharePoint.Client.dll). This works fine with the code below for sharepoint 2013 and above. It works for sharepoint online and sharepoint server. The problem is for sharepoint 2010 server where I need to read. An exception occurs like "The Field or Property UniqueId is not available". The "ListItemAllFields" is not available either. I read many posts but I could not found a solution. 

I could figure out that there would be normaly 3 solutions for it:

1. csom (Would be the best solution and works perfect for 2013 and above -> no solution found for 2010 server)
2. ssom (Works only when everything is on the same server -> is no solution for me because the application where I need to read is not on the same server like sharepoint)
3. webservices (I could not found a matching solution with webservices)

I read about Caml query and found something like 
<FieldRef Name='UniqueId'/>
but I don't know how to use it and I don't know if reading UniqueId even is possible with it.

Here the code which works fine for sharepoint 2013 and above but did not work for sharepoint 2010 server:

   
public string GetChilds(ClientContext clientContext, string relativeUrl)    
{
  SpFolder folder=clientContext.Web.GetFolderByServerRelativeUrl(relativeUrl);      
clientContext.Load(folder,                   
  item => item.Name,                   
  item => item.UniqueId,                   
  item => item.ServerRelativeUrl                   );          

  clientContext.Load(folder.Folders,        items => items.Include(                        
    item => item.Name,                       
    item => item.UniqueId,                       
    item => item.ServerRelativeUrl,      item => item.TimeLastModified,    item => item.TimeCreated,                        
    item => item.ListItemAllFields["Author"],              
    item => item.ListItemAllFields["Editor"]));      clientContext.Load(folder.Files,      items => items.Include(        item => item.Name,          item => item.UniqueId,        item => item.ServerRelativeUrl,      item => item.TimeLastModified,      item => item.TimeCreated,      item => item.ListItemAllFields["Author"],          item => item.ListItemAllFields["Editor"],    item => item.ListItemAllFields["File_x0020_Size"]));           
 clientContext.ExecuteQueryWithIncrementalRetry(EXECUTEQUERY_RETRYCOUNT, EXECUTEQUERY_DELAY);   

  string result = "";    result += "Parent Name:" + folder.Name + ",";  result += "Parent UniqeId:" + folder.UniqueId.ToString() + ",";    result += "Parent ServerRelativeUrl:" + folder.ServerRelativeUrl + ",";  if (folder.Folders != null)      {        foreach (SpFolder subFolder in folder.Folders)        {            result += "Name:" + subFolder.Name + ",";        result += "UniqueId:" + subFolder.UniqueId.ToString() + ",";      //...       
    }      }        
  if (folder.Files != null)    {        foreach (SpFile file in folder.Files)       {
      result += "Name:" + file.Name + ",";        result += "UniqueId:" + file.UniqueId.ToString() + ",";        //...      }    }        return result;  
}

The expected result would be retrieving the UniqueId and ListItemAllFields from sharepoint 2010 server. 
The actual result is: "The Field or Property UniqueId is not available".
Viewing all 11571 articles
Browse latest View live


Latest Images

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