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

SharePoint Version label in Word Document Problem

$
0
0

Hi all,

Hoping somebody can help as I am quickly running out of ideas. I've setup a Document Library and created the {Version} within each document type, however when I create a document the following error message gets displayed:-

Some information required to complete this label is missing. To add the information now, click OK. To add the information later, click Cancel.

It appears that the label for {Version} or {_UIVersionString} as it is seen in the document is not able to be referenced.

Products are SharePoint 2013 and Word 2013

Kind Regards,

Neil


UserProfileService in SP2013 foundation

$
0
0

Hei guys!

I know, that UserProfile Service is not available for SP2013 foundation as in Sharepoint. 
But is it possible to develop a c# console application, where you can use UserProfileManager and still use this with SP 2013 foundation?


Unauthorized Operation in SharePoint 2013 WebServices

$
0
0

Hello everyone,

I have an application (Provider-Hosted) that connects to UserProfileServices.asmx on SharePoint Online 2013.

The main functionality is to retrieve and update the user profile properties and privacy. I know that is possible to update the profile properties using CSOM now, but it isn't possible to retrieve and update the privacy of such.

So, the problem is: My application was running fine and from nowhere it start to throw an exception in every method.

My authentication is working fine, the problem is when i call some methods.

Infos:

WebService: https://mysite-admin.sharepoint.com/_vti_bin/UserProfileService.asmx
User: Global Administrator
It is a Provider-Hosted application.
DLL: Microsoft.SharePoint.Client  //  File Version: 15.0.4641.1000 (tried with 16.0.3104.1200 too)

Code to Authenticate (working fine):

var securePassword = new SecureString();
foreach (char c in password)
{
    securePassword.AppendChar(c);
}

var onlineCredentials = new SharePointOnlineCredentials(login, securePassword);

string authCookieValue = OnlineCredentials.GetAuthenticationCookie(_targetAdminSite);
var cookieVal = authCookieValue.TrimStart("SPOIDCRL=".ToCharArray());

_userProfileService.Credentials = System.Net.CredentialCache.DefaultCredentials;

_userProfileService.CookieContainer = new CookieContainer();
_userProfileService.CookieContainer.Add(new Cookie("FedAuth", cookieVal, String.Empty, _targetAdminSite.Authority));

Methods:

var userProfile = _userProfileService.GetUserProfileByName("i:0#.f|membership|" + _targetUser);

var profileSchema = _userProfileService.GetUserProfileSchema();

Exception (when calling a method):

Server was unable to process request. ---> Attempted to perform an unauthorized operation.

Anyone knows what i should do to solve this?

Thanks for your time and efforts!

Reference:

https://msdn.microsoft.com/en-us/library/office/websvcuserprofileservice.aspx


How do I change the width of a column in a data grid view.

$
0
0

I have tried using the Google jQuery script attachd to a content editor. But that does not seem to affect a column when the view is a data grid in edit mode.

I added a notes column and the text is all squished in a column about an inch wide, but the cell is about 6 inches high. I need it to be about 5 inches wide.

This is the script I am trying to use. I saved it as ResizeColumnMigrationNotes.txt in a scripts library in the same site.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$("TH.ms-vh2-nograd:contains('Migration')").css("width", "600px");
});
</script>

External REST Service Authentication

$
0
0

Hello everyone.

Often creating complex business application using SharePoint Online, I need to externalize business logic to external service in order to use .net code and third-party assemblies.

In my case I'm developing a Rest Service hosted by an Azure Web Site.

My question is:

Can I obtain an access Token from SharePoint, containing the current user information, pass it to external Rest Service and then reuse it to return to SharePoint using the current user credentials?

Can you give be documentation about it?

Thanks,

Sergio


Regards,
Bubu
http://zsvipullo.blogspot.it

Please mark my answer if it helped you, I would greatly appreciate it.

REST Service with admin access

$
0
0

We have SharePoint 2013 server. We are implement the some  webpages that will utilize the REST service. currently all the REST calls are runs under current user credential. is their anyway to run the REST call with admin privilege.

We don't have any azure subscription.


Ravin Singh D

People editor control multiuser

$
0
0

Hi  guys,

i have a WebPart  with a A SP People editor , i can pick up the value of one user  but if there are more then  one user how can i do it?

This is my code:

 SPFieldUserValue value = null;
                        if (ProjectTeam.ResolvedEntities.Count > 0)
                        {
                            for (int i = 0; i < ProjectTeam.ResolvedEntities.Count; i++)
                            {
                                try
                                {
                                    Microsoft.SharePoint.WebControls.PickerEntity user = (Microsoft.SharePoint.WebControls.PickerEntity)ProjectTeam.ResolvedEntities[i];

                                    switch ((string)user.EntityData["PrincipalType"])
                                    {
                                        case "User":
                                            SPUser webUser = web.EnsureUser(user.Key);
                                            value = new SPFieldUserValue(web, webUser.ID, webUser.Name);
                                            break;

                                        case "SharePointGroup":
                                            SPGroup siteGroup = web.SiteGroups[user.EntityData["AccountName"].ToString()];
                                            value = new SPFieldUserValue(web, siteGroup.ID, siteGroup.Name);
                                            break;
                                        default:
                                            SPUser spUser = web.EnsureUser(ProjectTeam.Accounts[i].ToString());
                                            value = new SPFieldUserValue(web, spUser.ID, spUser.Name);
                                            break;
                                    }
                                }
                                catch (Exception ex)
                                {
                                    // log or do something
                                    SPUser spUser = web.EnsureUser(ProjectTeam.Accounts[i].ToString());
                                    value = new SPFieldUserValue(web, spUser.ID, spUser.Name);

                                }
                            }
                        }

Thank you!

How do I copy files to another library along with all metadata?

$
0
0

I have a PowerShell script that I want to use to copy/move files from one Form Library to another. The script does the copying and brings along most of the metadata, except for the authoring metadata. This is what my current script looks like, what am I doing wrong here? The "Modified" & "Created" dates are copied across just fine, but not the "Modified By" & "Created By" fields. My copied files are all showing "System Account" for "Modified"& "Created By", instead of the user who created and/or modified the items. 

[CmdletBinding()]
	param(
	[Parameter(position=1, mandatory=$true, parametersetname="Default")] [string]$SourceList,
	[Parameter(position=2, mandatory=$true, parametersetname="Default")] [string]$DestinationList
	)

function create-fileitems()
{
	$src = $SourceList
	$SourceWebURL = "http://company.com/sites/someSite/"
	$tgt = $DestinationList
	$DestinationWebURL = "http://company.com/sites/SomeSite/"

	$sWeb = Get-SPWeb $SourceWebURL
	$sList = $sWeb.Lists | ? {$_.Title -eq $src}
	$dWeb = Get-SPWeb $DestinationWebURL
	$dList = $dWeb.Lists | ? {$_.title -like $tgt}

	$AllFolders = $sList.Folders
	$srcRootFolder = $sList.RootFolder
	$allfiles = $src.items
	$RootItems = $srcRootFolder.files
	#$destRootFolder = $tgt.RootFolder

	foreach($RootItem in $RootItems)
	{
		$sBytes = $RootItem.OpenBinary()
		$dFile = $dList.RootFolder.Files.Add($RootItem.Name, $sBytes, $true)
		$AllFields = $RootItem.Item.Fields | ? {!($_.sealed)}
		$ditem = $dfile.Item
		$ditem["Modified"] = $RootItem.TimeLastModified.ToLocalTime()
		$ditem["Created"] = $RootItem.TimeCreated.ToLocalTime()
		$ditem["Author"] = $RootItem.Author
		$ditem["Editor"] = $RootItem.ModifiedBy
		$dFile.Update()
		$ditem.Update()
		write-host "File Copy:"$dfile.Name" - Complete"
	}
	foreach($Folder in $AllFolders)
	{
		$srcFolderURL = $folder.url
		$destFolderURL = $srcFolderURL
		$destFolderURL = $destFolderURL -replace $srcRootFolder, $destRootFolder
		$srcItems = $Folder.folder.files

		if(!($tgt.Folders | ? {$_.URL -eq $destFolderURL}))
		{
			$parentFolderURL = $folder.folder.parentfolder.serverrelativeurl
			$parentFolderDestination = "KB/" + $destRootFolder
			$parentFolderURL = $parentFolderURL -replace $srcRootFolder, $parentFolderDestination
			$newFolder = $tgt.Additem($parentFolderURL,[Microsoft.SharePoint.SPFileSystemObjectType]::Folder,$folder.name)
			$newFolder.Update()
			write-host "Folder Creation:"$destFolderURL" - Complete"
		}

		$destFolder = $tgt.Folders | ? {$_.url -eq $destFolderURL}
		if($Folder.Folder.Files.count -gt 0)
		{
			$srcItems = $Folder.folder.Files
			foreach ($item in $srcItems)
			{
				$Relative = $Item.URL
				$TargetItem = $AllFiles | ? {$_.URL -eq $Relative}
				$sBytes = $TargetItem.File.OpenBinary()
				$dFile = $destFolder.Folder.Files.Add($TargetItem.Name, $sBytes, $true)
				$ditem = $dfile.Item
				$ditem["Modified"] = $Item.TimeLastModified.ToLocalTime()
				$ditem["Created"] = $Item.TimeCreated.ToLocalTime()
				$ditem["Author"] = $Item.Author
				$ditem["Editor"] = $Item.ModifiedBy
				$dFile.Update()
				$ditem.Update()
				write-host "File Creation:" $dfile.name" - Complete"
			}
		}
	}
}
#}

 create-fileitems ($SourceList,$DestinationList)

Is there a way to get this done? Thanks you so much.


Developer Site Template missing on Foundation 2013

$
0
0

How to add Developer Site Template to my Sharepoin Foundation 2013, which I have installed with TFS-2013?

There is no such template when I try to create new site.

Some recommends to activate hidden feaure:

Enable-SPFeature e374875e-06b6-11e0-b0fa-57f5dfd72085 -url http://sp2013dev:8383

but system tells that it is already activated:

Feature 'Developer' (ID: e374875e-06b6-11e0-b0fa-57f5dfd72085) is already activated at scope

"Title, Description and Document Icon" item style and Content Query Web Part

$
0
0

Why is that Content Query Web Part when used with "Title, Description and Document Icon" item style sometimes displays "Title" field correctly and sometimes does not correctly? Also, on some web parts I am seeing Title field in the properties section and on others I do not see Title field at all in the web part configuration's "presentation" section.

Adding Custom WebPart in AllUsersWebPart in SharePoint 2013

$
0
0

Hi 

I am trying to add the Custom WebPart to Custom PageLayout using 

AllUsersWebPart.

But the webpart is not adding to the page when created.

The same code if i am adding to Pages

AllUsersWebPart , its coming.

Is there any thing need to do with PageLayout AllUsersWebPart property

  <![CDATA[              
        <?xml version="1.0" encoding="utf-8"?>
        <webParts>
          <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
            <metaData>
              <type name="SolutionX.ProjectY.WebParts.MyWebPart, $SharePoint.Project.AssemblyFullName$" />
              <importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage>
            </metaData>
            <data>
              <properties>
                <property name="Title" type="string">My WebPart</property>
                <property name="Description" type="string">My WebPart for XYZ</property>
                <property name="ListName" type="string">ExampleList</property>
                <property name="RowLimit" type="string">5</property>
              </properties>
            </data>
          </webPart>
        </webParts>
        ]]>
      </AllUsersWebPart>

Thanks

SPKids



Sharepoint 2013 Custom Pagelayouts

$
0
0

Hi there,

I am confused about pagelayouts, and hope I can get some help here.
Would sharepoint pagelayouts only works for Publishing portal? What about pagelayout in non-publishing sites, for example, TeamSites with publishing feature activated.

I have a pagelayout, it shows up in publishing site, but with team site (publishing feature activated), I can not see my pagelayout in options when create new pages in Pages library.

Can anyone help me on this?

Promoted Links Dialog Pop Up Size

$
0
0

Hi All,

I am using Promoted Links with launch behavior = "Dialog"

I manage to change the Dialog size by adding a Content Editor into my Main page with the following code

<style type="text/css">

.ms-dlgContent

{

   width:1500px !important;

   height:1000px !important

}

.ms-dlgBorder

{

   width:1500px !important;

   height:1000px !important

}

</style>

The Dialog width and height did increase, however the Content itself seems to be in a fix width with scroll bars.

How can I also have my Dialog contents width and height to increase? Many Thanks in advance.

kb 2920746 onedrive february breaks client - again

$
0
0

Hello together,

i'm sick of this sync client. Every time i try to update to the latest version i get new errors. Last time i needed another update to fix the app crashes.

We are having Sharepoint 2013 SP1 on premise and Office 2013 SP1. This time i only installed the client on 2-3 machines and it crashes now an then.

Anyone else experiencing these problems?

This is the error in eventlog:

Fehlerbucket , Typ 0
Ereignisname: APPCRASH
Antwort: Nicht verfügbar
CAB-Datei-ID: 0

Problemsignatur:
P1: GROOVE.EXE
P2: 15.0.4693.1000
P3: 54b5d205
P4: StackHash_59ff
P5: 6.1.7601.18247
P6: 521ea8e7
P7: c0000374
P8: 000ce753
P9:
P10:

Angefügte Dateien:
user\AppData\Local\Temp\CVRE3F5.tmp.cvr

Diese Dateien befinden sich möglicherweise hier:
user\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_GROOVE.EXE_4ca447a5ea7e45073b1da98cb24848a8992fa_4fd525c5

Analysesymbol:
Es wird erneut nach einer Lösung gesucht: 0
Berichts-ID: e6302218-bec4-11e4-bed4-00237dc3cbf3
Berichtstatus: 0

Best regards

Stephan

SharePoint 2013 New Item form shows inline with list items instead of on a new page.

$
0
0

I have been working on a SharePoint 2013 List Form using InfoPath.

Normally when I hit "New Item" the form opens on a new page, but something has changed and the form now opens inline with the list items.  Essentially you see the list items, then at the bottom, on the same page, is the new form.  It all appears to work OK, I just want to return to the new form opening on a new page, like all my other forms do.  Also, when editing an existing list item the form opens in a new page, so it's just the new item instance that has changed.

Any suggestions on what changed and steps on how to change it back would be most appreciated as I am baffled.

Thanks,
Andy


Analytics Data Returning Null

$
0
0

Guys,

Has anyone faced a problem of fetching Rollup analytical data. I have configured usage and health configuration in monitoring section of central admin and also ran search crawl in SharePoint 2013. Enabled Microsoft SharePoint Foundation Usage Data Import and Microsoft SharePoint Foundation Usage Data Processing to minutes and daily but still not able to get the rollup data. I can't see any data in AnalyticsItemData TABLE of Search_Service_Application_AnalyticsReportingStoreDB.

Using following code to fetch result 

var context = SPServiceContext.GetContext(site);
                    var searchProxy = context.GetDefaultProxy(typeof(SearchServiceApplicationProxy)) as SearchServiceApplicationProxy;
                    var usageData = searchProxy.GetRollupAnalyticsItemData(1, Guid.Empty, site.ID, Guid.Empty);
                    if (rdHitCountDaily.Checked)
                    {
                        lblResHitCount.Text = "Result : " + usageData.GetHitCountForDay(dpHitCount.Value) + "";
                    }
                    else if (rdHitCountMonthly.Checked)
                    {
                        lblResHitCount.Text = "Result : " + usageData.GetHitCountForMonth(dpHitCount.Value) + "";
                    }
                    else
                    {
                        lblResHitCount.Text = "Result : " + usageData.TotalHits + "";
                    }

usageData is null and not returning any result.

Let me know if anybody has any solution to this issue?

Nitin


Nitin Gupta SharePoint Consultant

“DTD is prohibited” error when accessing sharepoint 2013/office365 list (but not openly aware of using XML)

$
0
0

I've been getting a list of folders and files from Sharepoint (on Office 365) by using the following C# code...

...
var folders = ListFolders(libraryName, clientContext, web);
...   

public List<Folder> ListFolders(string libraryName, ClientContext clientContext, Web web)
{
    var list = GetDocumentLibrary(libraryName, clientContext, web);    var folders = list.RootFolder.Folders;    clientContext.Load(folders);    clientContext.ExecuteQuery();    return folders.ToList();       
}   

public List GetDocumentLibrary(string libraryName, ClientContext clientContext, Web web)
{
    var query = clientContext.LoadQuery(web.Lists.Where(p => p.Title == libraryName));   clientContext.ExecuteQuery();
    return query.FirstOrDefault();
}


It was working fine until I rebooted my computer (it installed a Windows Update), I strongly suspect, based on some testing I've done, it is caused by http://support.microsoft.com/kb/2964358 

When the *clientContext.ExecuteQuery()* statement is reached in *GetDocumentLibrary()*, the
following exception is thrown.

*An unhandled exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
Additional information: For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method.*

I'm wondering how I can work around this, as I'm not consciously using System.XML, it's a background function or process when the ExecuteQuery runs. 

Can I pass some additional XMLReader info to this or clientContext (I'm assuming not), so I'm not sure how to execute this query to prevent the DTD error. I have also tried accessing the list in a different manner, by using this code... (from Microsoft's MSDN pages)

List list = clientContext.Web.Lists.GetByTitle(libraryName);

CamlQuery camlQuery = new CamlQuery();           

camlQuery.ViewXml = "<View/>";

ListItemCollection listItems = list.GetItems(camlQuery);

clientContext.Load(list); clientContext.Load(listItems);

clientContext.ExecuteQuery();

This works on a computer without the KB above, however on my PC it doesn't (I get the same exception as my other code) , obviously uninstalling the KB will make things work in the short term, but its no good in the longer term. Any advice on how to avoid this error would be greatly appreciated.  I can only assume there will be a "preferred" way from Microsoft for accessing lists now this KB is implemented, but I'm clueless as to what it is.

Thanks
Dougie


Filter in a BCS

$
0
0

Hi!

I'm doing an External Content type in Visual Studio and I'm trying to create a default filter to minimize the amount of data that I get from the webservice.

I want to select all rows from the webservice between two dates.

Can I somehow create that filter with variables? Like filter from [today] to [today+3]??

In the .ect file I can find the filter descriptors but the Comparator is "Equals" I want them to be "bigger than" and "smaller than" ... but I cand find any documentation of it?

<FilterDescriptor Name="StartDateTimeFilter" DefaultDisplayName="StartDateTimeFilter" Type="Comparison" FilterField="StartDateTime">
                  <Properties>
                    <Property Name="Comparator" Type="System.String">Equals</Property>
                  </Properties>
                </FilterDescriptor>
                <FilterDescriptor Name="StopDateTimeFilter" DefaultDisplayName="StopDateTimeFilter" Type="Comparison" FilterField="StopDateTime">
                  <Properties>
                    <Property Name="Comparator" Type="System.String">Equals</Property>
                  </Properties>
                </FilterDescriptor>

Data Refresh Error: We cannot locate a server to load the workbook Data Model.

$
0
0

Hello,

Recently I have developed a PowerBI Report using Excel Workbook with external data source. It refreshes successfully for some days and then starts throwing error on every scheduled refresh as"We cannot locate a server to load the workbook Data Model." 

The workaround solution is to restart the application server which has SQL Server Power Pivot Services Installed which will again work for some more days and again start throwing error.

So, I am looking for permanent fix for it.

Following are additional details about our SP Farm:

No. of front end servers: 2, Application servers:2, DB servers 2 with windows fail over cluster.

PowerPivot Server is installed and configured from App 2 server.

Error Log from event viewer:

Unable to load custom data source provider type: Microsoft.PerformancePoint.Scorecards.DataSourceProviders.AdomdDataSourceProvider, Microsoft.PerformancePoint.Scorecards.DataSourceProviders.Standard, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AnalysisServices.AdomdClient, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.AnalysisServices.AdomdClient, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
   at System.Type.GetType(String typeName, Boolean throwOnError)
   at Microsoft.PerformancePoint.Scorecards.Server.PmServer.InitializeCustomDataSourceProviders()

PerformancePoint Services error code 10107.

Thanks,

Ibrahim

How to Hide some Rows in a List view Web Part using JavaScript ?

$
0
0
How to Hide some Rows in a List view Web Part using JavaScript ?
Viewing all 25064 articles
Browse latest View live


Latest Images

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