Freitag, 11. Dezember 2015

JSLink: Load multiple JavaScript files (e.g. jQuery)

Problem:
You want to load multiple JavaScript files to use when rendering e.g. a field in SharePoint 2013. For example you use a library such as jQuery. In either case, you need all the scripts loaded before you can start rendering.

Solution:
It is possible to download multiple JavaScript files when loading the web part. Just separate them with the pipe character, i.e. |.
For example, to load ~sitecollection/_catalogs/masterpage/jQuery.js and ~sitecollection/_catalogs/masterpage/my-custom-field.js, set the JSLink property of your target to:
JSLink="~sitecollection/_catalogs/masterpage/jQuery.js|~sitecollection/_catalogs/masterpage/my-custom-field.js"
Do not worry about SharePoint re-downloading the same script repeatedly if you use it to render multiple elements, SharePoint will not download a script more than one time.

Freitag, 9. Oktober 2015

Can not perform this operation. The file is no longer checked out or has been deleted.

Problem:
While working with files in SharePoint Designer 2010 or Word 2010 and you attempt to check in a document you receive the following error message:
Can not perform this operation. The file is no longer checked out or has been deleted.
The cause of this issue is you have connected SharePoint Designer 2010 to an Alias for the site (DNS CName) which has not been configured as an Alternate Access Mapping for the site (AAM).


Solution:
Connect SharePoint Designer 2010 to the host name while performing these file operations. Not ideal but will work.
Or better:
Add the DNS alias to the Alternate Access Mappings in Central Administration. This will require access to central administration.

Freitag, 14. August 2015

Is Microsoft OneDrive secure?

OneDrive does the following:
  • All content is encrypted, potentially with multiple keys, and distributed across the datacenter. Each file to be stored is broken into one or more chunks, depending its size. Then, each chunk is encrypted using its own unique key. Updates are handled similarly: the set of changes, or deltas, submitted by a user is broken into chunks, and each is encrypted with its own key.
  • All of these chunks—files, pieces of files, and update deltas—are stored as blobs in our blob store. They also are randomly distributed across multiple blob containers.
  • The set of encryption keys for these chunks of content is itself encrypted using an independently generated master key.
  • The encrypted keys are stored in the SharePoint Content Database.
  • The master key to decrypt the keys to the chunks is itself stored in a separate secure store called the Key Store.
  • The “map” used to re-assemble the file from its components is stored in the Content Database along with the encrypted keys but separate from the master key needed to decrypt them.
  • Each blob container has its own unique credentials per access type (read, write, enumerate, and delete). Each set of credentials is held in the secure Key Store and is regularly refreshed.
If you are able to do all of that in your own infrastructure - do it (Congratulations)
If not, I would think it is save to use...

More info: http://aka.ms/dataencryption

Dienstag, 14. Juli 2015

SharePoint Sudden Site Lock

Problem:
You experience a sudden site lock "read-only", what appeared to be a total lock down on the SharePoint sites.  It results in ALL users, even site administrators and users with full administrative rights are unable to do anything!  Nobody could add new documents or edit documents; nearly every single Document or Library option is greyed out!
A possible cause could be that you started a SharePoint backup (during backup the site is locked) via Powershell and canceled the process while running. So the command is not able to unlock the sites afterwards.




Solution:
Fix via the central administration website:
  1. Central Administration -> Site Collection Quotas and Locks.
  2. Select your site collection
  3. Change the Site Lock Information radio button from “Read-only” to “Not locked”
  4. OK

Dienstag, 30. Juni 2015

Monitoring crawler impact

Problem: Do you know what your SharePoint Search Crawler is doing?

Solution: If you want to monitor what the SharePoint crawler is doing, you can watch the Threads Accessing Network, Filtering Threads and Idle Threads from the OSS Search Gatherer category in Performance Monitor during a content crawl.

In my development VM, I see that the number of filtering threads stays at around 20 and the number of idle threads around 12 for the duration of the crawl which means that an average of 8 threads are being used by the gatherer process.

In SharePoint 2010, you can control the content crawl rate at the search service application level by using Crawler Impact Rules. By default, the number of simultaneous requests changes dynamically based on the server hardware and utilization. Crawler impact rules are often used to throttle the request rate for external websites. You can manage crawler impact rules in Central Administration > Search Service Application > Crawler Impact Rules.

Next, let’s create a new crawler impact rule to limit the number of simultaneous requests to 2 using the * site name wildcard to apply the rule to all sites.

If we keep an eye on the performance counters this time, we can see that now the difference between the number of filtering and idle threads during a crawl equals to 2 (11 filtering threads and 9 idle threads in the example below).

The performance counters confirmed that our new crawler impact rule is working. Be careful when you delete a crawler impact rule though! I’ve seen it a number of times in different SharePoint farms that SharePoint remembers and keeps using the last deleted crawler impact rule. I verified it by monitoring the performance counters – the deleted crawler impact rule remains in effect until the the SharePoint Server Search 14 service is restarted (or a new rule is added that overrides the deleted rule settings). So remember – restart the SharePoint Server Search 14 windows service after deleting a crawler impact rule!

Mittwoch, 10. Juni 2015

WCF WebService Factory for SharePoint 2010

Problem:
When you create your own SharePoint WCF Service in the ISAPI folder you might encounter the following error when sending to large Xml.

The maximum array length quota (16384) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader.

Solution:
You need to create your own Service Host Factory.
<% @ServiceHost Debug="true"
    Service="ExampleHostFactory.TestService, ExampleHostFactory, Version=1.0.0.0, Culture=neutral, PublicKeyToken=11e99323d9a22b04"
    Factory="ExampleHostFactory.ServiceHostFactory, ExampleHostFactory, Version=1.0.0.0, Culture=neutral, PublicKeyToken=11e99323d9a22b04" %>



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Client.Services;
using System.ServiceModel;
using System.ServiceModel.Description;

namespace ExampleHostFactory
{
    public class ServiceHostFactory : MultipleBaseAddressBasicHttpBindingServiceHostFactory
    {
        protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
        {
            ServiceHost serviceHost = new MultipleBaseAddressBasicHttpBindingServiceHost(serviceType, baseAddresses);

            if (serviceHost != null)
            {
                serviceHost.Opening += new EventHandler(HostOpening);
            }

            return serviceHost;
        }

        void HostOpening(object sender, EventArgs e)
        {
            ServiceHost serviceHost = sender as ServiceHost;

            if (serviceHost != null && serviceHost.Description != null && serviceHost.Description.Endpoints != null)
            {
                foreach (ServiceEndpoint endpoint in serviceHost.Description.Endpoints)
                {
                    if (endpoint != null && endpoint.Binding != null)
                    {
                        BasicHttpBinding basicBinding = endpoint.Binding as BasicHttpBinding;
                        if (basicBinding != null)
                        {
                            // configure binding settings
                            basicBinding.MaxReceivedMessageSize = Int32.MaxValue;
                            basicBinding.ReaderQuotas.MaxArrayLength = Int32.MaxValue;
                            basicBinding.ReaderQuotas.MaxBytesPerRead = Int32.MaxValue;
                            basicBinding.ReaderQuotas.MaxStringContentLength = Int32.MaxValue;
                        }
                    }
                }
            }
        }
    }
}

Disabled users in SharePoint


Problem:
Do you have disabled users from active directory appear in SharePoint?

There are scenarios you might observe disable person's details will appear in SharePoint people search, they will still show in the organization chart webpart in my site etc. In the configuration of the user profile service you can filter the disabled user accounts from active directory to SharePoint.

Solution:
Filter the disabled user accounts in user profile service

Go to [Central administration] [Application Management] [Manage Service Applications] [User Profile Service Application]

Click on Configure Synchronization Connections

From the connections you are using click on Edit Connection Filters menu.


It will open the Edit Connection Filters screen from that you can see Exclusion filter for users. In Exclusion filter for users enter the below values.

Attribute : userAccountControls (Select from dropdown)
Operator: Bit on Equal (Select from dropdown)
Filter : 2

Once you enter the required values click on Add button and it will show the below details in Exclusion filter for users section.
Finally click on ok button to submit the Edit connection filters details. Once you are done do a full synchronization run.

Problem 2:
This does not filter users in the SharePoint address book.

Solution 2:

By configuring the settings for the control, you can filter and restrict the results that are displayed when a user searches for a user, group, or claim. Those settings will apply to every site within the site collection.

The following example filters out user accounts that do not have e-mail addresses, or that are disabled. Because security groups do not always have e-mail addresses associated with them, an OR statement is used to ensure that security groups are still included in the query results:

stsadm -o setproperty -pn peoplepicker-searchadcustomfilter -pv "(|(&(mail=*)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))(objectcategory=group))" -url http://ServerName