Dienstag, 17. Dezember 2013

Language issues with SharePoint online and Office 365

What's wrong, when you have set in SharePoint 2013 online all language and region settings to a language, but there are still appearing some labels/alerts, etc. in the previous language? Why does the language setting not work correctly?

A customer of mine had this issue. The solution is, that Microsoft installs the default language according to the country they are billing. That means a German billing address will get a German default language install. In combination with Office 365 there might be still some labels and alerts set to German, even when you changed all language and regional settings to e.g. English.

There is just one way to solve this. You will have to contact Microsoft and ask for a fresh install of your SharePoint 2013 online. This worked for my customer. It seems there is still the step missing, that Microsoft should ask the customer, which default install language they prefer.

Cannot start service spusercodev4 on computer

I tried to deploy a sandbox solution out of Visual Studio 2010 and received the following error:
cannot start service spusercodev4 on computer
Somehow the "Microsoft SharePoint Foundation Sandboxed Code Service" in Central Administration stopped.
Go to Central Administration -> System Settings -> Manage services on server and pick there the service mentioned above and restart. I read on another blog, that also the "Microsoft SharePoint Foundation User Code Service" service might cause this trouble. If my solution does not work, please refer to this blog:
http://blog.dennus.net/2009/11/18/sp2010-spusercodev4-your-new-web-part-project-isnt-deploying/

Donnerstag, 21. November 2013

Custom field type -error

I had a .NET Error when creating a custom field type in my SharePoint list:
Microsoft.SharePoint.SPException: Field type FolderField is not installed properly. Go to the list settings page to delete this field.
at Microsoft.SharePoint.SPFieldCollection.GetDotNetTypeForFieldType(String typeName)
at Microsoft.SharePoint.SPFieldCollection.CreateNewFieldInternal(String typeName, String displayName)
at Microsoft.SharePoint.ApplicationPages.FieldNewPage.Save()

Reason therefore was an error in my fldtypes_MyCustomField.xml.
There I had a wrong FieldTypeClass. It should be this way:
<Field Name="FieldTypeClass">[Class with Namespace Test.MyCustomField], [Assembly-name], Version=1.0.0.0, Culture=neutral, PublicKeyToken=b426d5u8827cb6b6</Field>

Montag, 14. Oktober 2013

file.OpenBinary() - access denied

I ran over an error, which can be confusing. I wanted to get a file in SharePoint 2010 programmatically and suddenly I received the error at file.OpenBinary(), that the access is denied. I checked all the permission and was even more confused, because everything was set correctly. I was accessing via elevated privilages and this made me wonder even more.
The solution was really simple. The path to the file was wrong. Usually I would expect a file not found error message in SharePoint, but it seems an access denied is thrown in this case.
The path was not wrong in a matter, that the library was not existing, it was more, that the path went deeper in the folder structure than there was any existing in the library.

Donnerstag, 10. Oktober 2013

Secure Store Service SharePoint 2010 GetCredentials Access denied

I had the problem, that I wanted to impersonate to SecureStoreService of SharePoint 2010 programmatically, but received an access denied at the point where the method GetCredentials is called.
This happen to me twice in different scenarios:
1. I tried to impersonate in an Elevated environment. Of course, then the used system account has to be also a member of the SecureStoreService.
2. I undid the impersonation after the code sequence and it seems having different methods calling other methods, impersonated and undid and the wrong place, when other methods tried to access.
That means, be aware which account is currently running the code and that this account is also a member of the SecureStoreService.
Try to keep the impersonation area as small as possible, to impersonation does not interfere with other impersonation-efforts.


Mittwoch, 26. Juni 2013

Can't access the Active Directory

I had a problem on a server to access the Active Directory. The error-message led to the following method:

Server stack trace: at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind()

When debugging, I got the error that the Context was null.

What saved my day was to wrap the whole Active Directory performance into an impersonation.

using(HostingEnvironment.Impersonate())
{
My active directory code
}

Donnerstag, 11. April 2013

Resource file usage in SharePoint 2010 with Visual Studio 2010

There are two ways to use resource files in SharePoint.
One is with code-behind and the other is to render it in the control.
In the following image you see version (1) in line 9 and version (2) in line 10


Version 1 requires a resx file in the SharePoint 14 hive 'Resources' folder.
Version 2 requires a deployment to App_GlobalResources folder.

Important, if you want to have your resx file to deployed to the 14 hive, first map your project with the SharePoint Resources folder. Then place your resx file in there and you will need to set the Build Action in the resx property to 'Content' otherwise a deployment to the hive won't take place (file will not be physically copied to the hive folder).




Next thing is to click on your feature and set there the property 'DefaultResourceFile' to the neutral resource file and set 'Require Resources' to true.


How to deploy to the App_GlobalResources:
Create in your SharePoint 2010 project a new item "Empty Element". I called it 'ResourceFiles'.
Then you place your resource file in there. To test properly I named it the same and also added the same key with a different value.


When checking the properties of the resx file, set the Deployment Type to 'AppGlobalResource'


Deploy your solution and then check the result.
In my case according to that code


I had this result

Donnerstag, 14. März 2013

ULS Viewer no items

I had the problem, that when I started ULS Viewer, no items where displayed. Then checking the 14-hive of SharePoint and the log folder, all log files had 0 KB size. When checking the SharePoint log-settings, everything was set properly. The problem was, that the disc space ran out. I cleared the disc, so I had at least 1,2 GB space. I restarted the SharePoint 2010 Tracing (Windows) service. Then I deleted all the old 0 KB files in the log folder and voila, logs were written to the files and ULS viewer could display them.