If you get this (annoying) error then a possible solution is to check if your account which you use to administrate(or use the search service application) on the SQL Server side.

The search application ‘Search Service Application’ on server did not finish loading. View the event logs on the affected server for more information

Open Your SQL Server Management studio. Go to your Security folder, then Logins and then double click on your account which needs search privileges. Then go to user mapping in the new window and check that the following search service databases has privileges to your account and that the account has the “SPSearchDBAdmin” rights assigned:

Search Databases:

SharePoint_Service_Search

SharePoint_Service_Search_AnalyticsReportingStore

SharePoint_Service_Search_CrawlStore

SharePoint_Service_Search_LinksStore

Search Service Application Error

Search Service Application Error

If you happen to get the following errors related to site columns, features activation and/or solution package installation:

Unable to locate the xml-definition for FieldName with FieldId ‘Your field GUID’, exception: Microsoft.SharePoint.SPException —> System.Runtime.InteropServices.COMException: <nativehr>0x8000ffff</nativehr><nativestack></nativestack>
at Microsoft.SharePoint.Library.SPRequestInternalClass.GetGlobalContentTypeXml(String bstrUrl, Int32 type, UInt32 lcid, Object varIdBytes)
at Microsoft.SharePoint.Library.SPRequest.GetGlobalContentTypeXml(String bstrUrl, Int32 type, UInt32 lcid, Object varIdBytes)

Or Error message:

Field not found or invalid – ID: [your field GUID]

Then you have two options:

  1. Set the field attributes ‘Overwrite‘ and/or ‘OverwriteInChildScopes‘ to True => http://msdn.microsoft.com/en-us/library/office/aa979575(v=office.15).aspx
  2. Or if this does not help then what will kill your Microsoft support for you SharePoint installation is to modify the database directly(not recommended BUT if it is not a production environment and for some reason you need to do something quick and dirty to test something then this might be an option) =>http://shipoint.com/2012/06/07/removing-a-corrupted-site-column-in-sharepoint-2010/

 

I’ve been playing around with Swift for a few months now and have been happy with the language and making applications with it BUT there where problems, bugs and annoying crashes while developing with Swift and XCode. During the Beta phases this was OK but now that the XCode 6.0 is out as non Beta some of the same bugs still exists and for me two bugs are the most annoying and a show stopper which keeps me from not using Swift with iOS development up until Swift and XCode matures and the bugs are Fixed.

The two most annoying bugs are:

  • XCode “intellisense” and indexing crashing once application and code complexity evolves
  • Swift compiler bugs where you are forced to clean your development environment or create a new development environment from scratch because XCode and Swift compiler refuse to compile your code citing to illogical errors that are not there. This was a big show stopper since the code had no syntax errors and would compile on another Mac OS development image.

Long story short once my application grew in size, functionality and complexity Swift and XCode started to fall apart forcing me to state that I have to move to other languages and frameworks to do what I need to do for the application to work. As a developer nothing is more annoying than tools that do not work and make you use hours upon hours to fix or go around the issues.

Others seem to feel the same way:

http://2359media.com/developers-insight-swift-is-not-ready-for-production-code/

 

It’s a shame, Swift looks promising but for now it is best to stay away in anything else than small projects and testing of new functionality.

This fix is for when you are trying to add content to the editor web part when it is empty and causes a post back failing to added any content. Add this Jquery line to your JS file and the problem will go away. The problem is Microsoft SharePoint JavaScript that should replace the “add content” text in the editor webpart and the anchor href. By removing the href attribute fromt he anchor the MS JS will still work and the problem will go away:

$(“div.ms-WPBody.ms-wpContentDivSpace .ms-toolbar.ms-selectorlink”).removeAttr(“href”);

My co-worker introduced me to SignalR for ASP .NET. A very cool library to do real-time applications. I’ve done a messaging app and other real time components in the past manually with different tools and technologies but this is cool :). Check it out :)!

Microsoft ASP .NET Official Overview on SignalR

http://channel9.msdn.com/Events/TechEd/NorthAmerica/2014/DEV-B416/player?h=540&w=960&format=flash

If you are wondering how to do a ranged search query through the SP search service pass to the query service something below where the ranged functionality is in the green color. Just specify the start position at the StartAt, notice that the minimum start position is number one not zero. Then you pass in the Count part how many items to retrieve starting from the specified location. To do a paging like functionality you have to keep count in you code what is your paging range, current position and what to retrieve.

<QueryPacket><Query domain=”QDomain”><Context><QueryText type=”MSSQLFT”><![CDATA[ SELECT your fields here FROM Scope() WHERE IsDocument = 1 AND "SCOPE" = 'your scope name' AND CONTAINS (some sample field,'field data to contain') ORDER BY some field name]]></QueryText></Context><Range><StartAt>1</StartAt><Count>3</Count></Range><TrimDuplicates>false</TrimDuplicates></Query></QueryPacket>

 

Hi,

 

I while back I needed to do a security trim on files in a Windows file system based on returned search results by SharePoint search. Since in SharePoint 2010 search indexing does not know how to take into consideration file system rights for searches there was a need to do a security trimming based on what privileges you have in Active Directory and what you are given to the file itself.

Since there where alot of moving parts and hard to find out which classes and function where needed to actually do this specific task I finally found a source that gave a great sample how to do this:

http://www.conarc.com/blog/2010/03/25/programmatically-getting-effective-directoryfile-permissions/

Unfortunately the source above does not exist anymore for whatever reason. So for those who might need similar functionality through code here is the sample code from the link above and what you need class wise.

In the code below what you need is to call the following static function to check for if the user has certain privileges:

FileSystemRights rights = FileSystemEffectiveRights.GetRights(username, filelocation);

Then call the following function to test against the given file system privileges and what you want to user to have in the file system.
bool canReadExecute = rights.HasRights(FileSystemRights.ReadAndExecute);

 

Classes and enumeration needed for this functionality(there are many moving parts here and you might have to work with Active Directory and File System to test this code):

FileSystemRights Enumeration

FileSystemAccessRule Class

AccessControlType Enumeration

AuthorizationRuleCollection Class

SecurityIdentifier Class

FileSystemAccessRule Class

FileInfo Class

PrincipalContext Class

UserPrincipal Class

PrincipalSearcher Class

WindowsIdentity Class

 

Sample code – http://www.conarc.com/blog/2010/03/25/programmatically-getting-effective-directoryfile-permissions/ :

public static class FileSystemRightsEx
{
public static bool HasRights(this FileSystemRights rights, FileSystemRights testRights)
{
return (rights & testRights) == testRights;
}
}

public static class FileSystemEffectiveRights
{

public static FileSystemRights GetRights(string userName, string path)
{
if (string.IsNullOrEmpty(userName))
{
throw new ArgumentException(“UserName not defined!”);
}

//if (!Directory.Exists(path) && !File.Exists(path))
//{
// throw new ArgumentException(string.Format(“path: {0}”, path));
//}

return GetEffectiveRights(userName, path);
}

private static FileSystemRights GetEffectiveRights(string userName, string path)
{
FileSystemAccessRule[] accessRules = GetAccessRulesArray(userName, path);
FileSystemRights denyRights = 0;
FileSystemRights allowRights = 0;

for (int index = 0, total = accessRules.Length; index < total; index++)
{
FileSystemAccessRule rule = accessRules[index];

if (rule.AccessControlType == AccessControlType.Deny)
{
denyRights |= rule.FileSystemRights;
}
else
{
allowRights |= rule.FileSystemRights;
}
}

return (allowRights | denyRights) ^ denyRights;
}

private static FileSystemAccessRule[] GetAccessRulesArray(string userName, string path)
{
// get all access rules for the path – this works for a directory path as well as a file path
AuthorizationRuleCollection authorizationRules = (new FileInfo(path)).GetAccessControl().GetAccessRules(true, true, typeof(SecurityIdentifier));

// get the user’s sids
string[] sids = GetSecurityIdentifierArray(userName);

// get the access rules filtered by the user’s sids
return (from rule in authorizationRules.Cast<FileSystemAccessRule>()
where sids.Contains(rule.IdentityReference.Value)
select rule).ToArray();
}

private static string[] GetSecurityIdentifierArray(string userName)
{
// connect to the domain
PrincipalContext pc = new PrincipalContext(ContextType.Domain);

// search for the domain user
UserPrincipal user = new UserPrincipal(pc) { SamAccountName = userName };
PrincipalSearcher searcher = new PrincipalSearcher { QueryFilter = user };
user = searcher.FindOne() as UserPrincipal;

if (user == null)
{
throw new ApplicationException(string.Format(“Invalid User Name: {0}”, userName));
}

// use WindowsIdentity to get the user’s groups
WindowsIdentity windowsIdentity = new WindowsIdentity(user.UserPrincipalName);
string[] sids = new string[windowsIdentity.Groups.Count + 1];

sids[0] = windowsIdentity.User.Value;

for (int index = 1, total = windowsIdentity.Groups.Count; index < total; index++)
{
sids[index] = windowsIdentity.Groups[index].Value;
}

return sids;
}
}