Kanithi's Professional Blog

April 13, 2018

SharePoint Hybrid setup with O365

Here is the SharePoint Hybrid setup with Office 365 Playbook

Pre-requisites:

  • Before setting up Hybrid, SharePoint On-Prem has been upgraded to AUG 2017 patch level
  • Copy all Taxonomy Groups over to Cloud: Copy-SPTaxonomyGroups –LocalTermStoreName “Managed Metadata Service” –LocalSiteUrl “http://xxxxx” –RemoteSiteUrl “https://xxxxx.sharepoint.com” –GroupNames “XXXX” –Credential
  • Copy all Site Collection level Content Types to cloud
  • Need SPO account which is a Tenant GlobalAdmin as it configures several things in background it is recommended that you have a Global Admin access, but make sure this account has OneDrive License (SharePoint) attached to it and active My Site for this account, otherwise you will get "My site url or team site url gotten from Discovery Service is null or empty." error

                                 https://support.microsoft.com/en-us/help/3204761/-my-site-url-or-team-site-url-from-discovery-service-is-null-or-empty

  • If the Global Admin is not a synchronized account, then you will need another Synchronized account to setup custom managed properties at the Tenant level for Crawl Properties from on-prem. This account will have access to the on-prem SharePoint sites so that it can view the on-prem crawled properties in the SPO Tenant search schema.
  • Make sure you can browse SharePoint online Admin site on the servers and able to download the file, if browser prevents, then you need to enable it on the browsers
  • If any language packs used in on-prem, then make sure SPO Working Languages match that of on-prem; otherwise you will receive "Language exists in local term store but not in remote term store"
  • Before running hybrid picker, Term Store group data must be copied from Production to online using Copy-SPTaxonomyGroups command and chose specific Groups that we want to copy.
  • Copy Content Types and hub using Copy-SPContentTypes

SharePoint Hybrid Configuration Wizard Steps

image               image

image               image

image              image

After several, there may still be issues with UI based Hybrid Setup, like below, you need to use PowerShell scripts to finish the complete process

clip_image001   clip_image001[5]

Few Issues you may get

Authenticated realm updates option after setting up Hybrid, the provider hosted apps are throwing "Server Error in Application" errors and workflow manager workflows are gone on the SharePoint 2013 production farm.

https://support.microsoft.com/en-us/help/4010011/provider-hosted-add-ins-stop-working-and-http-401-error

-Run the scripts in this article: https://social.technet.microsoft.com/wiki/contents/articles/36338.fixing-apps-after-configuring-sharepoint-hybrid-features.aspx to fix the new realm ID and Security Tokens.

-The delete the workflow proxy through Central Admin and re-register the workflow service and make sure that the web applications are associated with the new proxy that is created.

I did some more research on the hybrid picker’s behavior and found the following: https://blogs.technet.microsoft.com/beyondsharepoint/2016/09/15/considerations-when-deploying-sharepoint-office365-hybrid-workloads-in-a-farm-utilizing-provider-hosted-add-ins-or-workflow-manager/

As for enabling hybrid search, I would recommend utilizing the CreateCloudSSA powershell script instead of using Hybrid Picker in order to prevent the Authentication Realm issue (especially if you have Provider Hosted Apps) from arising.

Troubleshooting Scripts

Get-SPServiceApplicationPool -Identity "DevCloudSSA_AppPool" | Remove-SPServiceApplicationPool

Commands to remove the Cloud SSA in case there are any errors and the partial SSA was created and could not be deleted using the GUI
================================================================================================
$P = Get-SPServiceApplication -identity 6042631f-7764-4256-8e60-9e15dcd4b3a1
Remove-SPServiceApplication $P -RemoveData
Remove-SPServiceApplication $P

Commands to verify that Cloud SSA is running:
==================================================
$ssa = Get-SPEnterpriseSearchServiceApplication -identity 36d90a85-d034-422e-97fb-8211d88431a6
Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa
Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Text | ft Name, state, Partition, Host -AutoSize
$ssa.CloudIndex

September 24, 2015

SharePoint 2013 Migration Issues (On-Prem)

Filed under: SharePoint 2010, SharePoint 2013 — Tags: , , , — Veera Kanithi @ 2:42 pm

We recently upgraded our SharePoint Farm to 2013, below are some of the issues or lessons learned during this process.

  • Use Everyone instead of NT Authority\Authenticated Users to avoid issues especially when accessing Managed Metadata fields. Faced permission issues in some migrated sites, even though NT Authority\Authenticated Users group has read access to it, Taxonomy Hidden list is the culprit, by providing everyone access to this list solved the issue
  • If you have used complex Calendar overlay features in SP2010, may face some formatting issues after migration to 2013
  • If you have multiple office product combinations for example office 2007 and Lync 2013, you may see issues opening office documents from SharePoint 2013 site in IE, may throw error as “The webpage cannot be displayed” with URL prefix as ms-word:ofv|u|

There is KB article on this issue (https://support.microsoft.com/en-us/kb/2888015) even though it says for SharePoint Online but still holds true for On-Prem, suggested solution in the article worked well but disabling the “SharePoint OpenDocuments Class” add-on from IE settings worked better

  • There were lot of issues with Data Sheet views in SP2010 after migration as in SP2013 there is no data sheet view and replaced with Quick Edit
    • Quick Edit doesn’t show counts unlike Data Sheet view in SP2010
    • Unlike Data Sheet view in SP2010, column widths cannot be changed
    • If the Data Sheet view in 2010 had read access, after migration to 2013, it will show empty data. It’s the same behavior even if you create a public Data Sheet view in SP2013, it will show as empty for read access users. Bottom line Quick Edit for people with modify access only
    • In SP2010 views are displayed under breadcrumb, this has been changed  in SP2013 and it will show under ellipses image . But the problem is not all Data Sheet views will show in the ellipses
    • You may see Quick Edit disabled on some views even though proper permissions are set. Quick Edit is disabled on the Views where the style is set other than default. If the SP2010 view has style as anything other than default, you may see issues on quick edit in 2013.image
    • Say good bye to column totals in Data Sheet view of SP2013

September 1, 2014

Custom web.config changes using generic feature receiver class

Filed under: .NET, SharePoint 2013 — Veera Kanithi @ 3:45 pm

While I was looking for a general solution to edit Web.Config using a SharePoint feature, I found an excellent article from Ryan McIntyre about creating an external XML file with all the custom modifications and using a common feature receiver it would take the changes from the external xml file and merge them in web.config using SPWebConfigModification object.

I am impressed with this approach, as this will eliminate frequent changes to the feature receiver class and avoid compilation and rebuilding WSP. Just simply change the XML file and re activate the feature, it’s that simple. Enough said, full details including the feature receiver class is in his site below.

http://randomdust.com/blogs/ryan/archive/2008/03/22/featurereceiver-for-applying-custom-web-config-changes.aspx

But the code Ryan used for feature receiver class, works only for element modifications not for creating new sections. In my case I got to create a new section and in the web.config file like “connectionStrings”. After further exploring, he used EnsureChildNode modification type, this will be good only for modifications, if you want create new sections we must use EnsureSection. But EnsueSection has a disadvantage, we can’t remove the sections from web.config on de activating the feature. But I felt it is fine to leave an empty section in the web.config, it doesn’t harm. Following are my modifications (highlighted) to the feature receiver class that Ryan developed, to accommodate both sections and elements.

protected SPFeatureReceiverProperties _properties;

public override void FeatureActivated(SPFeatureReceiverProperties properties) {

string fileLoc = properties.Definition.RootDirectory + “\\WebConfigChanges.xml”;

//Check to see if a WebConfigChanges.xml file exists. If yes, we have work to do

if (System.IO.File.Exists(fileLoc))

{

//Grab the properties

_properties = properties;

this.ProcessChanges(fileLoc, false);

}

}

public override void FeatureDeactivating(SPFeatureReceiverProperties properties) {

string fileLoc = properties.Definition.RootDirectory + “\\WebConfigChanges.xml”;

//Check to see if a WebConfigChanges.xml file exists. If yes, we have work to do

if (System.IO.File.Exists(fileLoc))

{                //Grab the properties

_properties = properties;

this.ProcessChanges(fileLoc, true);

}

}

public override void FeatureInstalled(SPFeatureReceiverProperties properties) {

/* no op */

}

public override void FeatureUninstalling(SPFeatureReceiverProperties properties) {

/* no op */

}

private void ProcessChanges(string FileLocation, bool removeModification)

{

string xPathLocation;

string elementName;

string sectionName;

Dictionary<string, string> attributes = new Dictionary<string, string>();

using (XmlReader reader = XmlReader.Create(FileLocation))

{

//Loop through all of the changes

while(reader.ReadToFollowing(“WebConfigChange”))

{

//Clean out any attributes from past iterations

attributes.Clear();

xPathLocation = reader.GetAttribute(“XPathLocation”);

elementName = reader.GetAttribute(“ElementName”);

//Check if there is any new Section required

sectionName = reader.GetAttribute(“SectionName”);

elementName = reader.GetAttribute(“ElementName”);

//Make sure we have at least a path and element

if (xPathLocation == null || elementName == null || sectionName == null)

                throw new Exception(“WebConfigChange missing required XPathLocation or ElementName or SectionName attributes”);

//Get the Attributes to apply

if (reader.ReadToDescendant(“Attribute”))

{

do

{

attributes.Add(reader.GetAttribute(“Name”), reader.GetAttribute(“Value”));

} while (reader.ReadToNextSibling(“Attribute”));

}

//Do the update

UpdateWebConfig(xPathLocation, elementName, sectionName, attributes, removeModification);

}

}

}

private void UpdateWebConfig(string XPathLocation, string ElementName, string SectionName,

  Dictionary<string, string> Attributes, bool removeModification)

{

try

{

SPWebApplication webApp = null;

//Get the web app

//First check if it was deployed to a Site Collection

SPSiteCollection siteCol = _properties.Feature.Parent as SPSiteCollection;

if (siteCol == null)

{

//Check if it was deployed to a site

SPSite site = _properties.Feature.Parent as SPSite;

if (site == null)

{

//Check if it was deployed to a Site

SPWeb web = _properties.Feature.Parent as SPWeb;

if (web != null)

webApp = web.Site.WebApplication;

}

else

webApp = SPWebApplication.Lookup(new Uri(site.Url));

}

else

webApp = siteCol.WebApplication;

if (webApp != null)

{

SPWebConfigModification modification;

//If no section name

          if (SectionName == null)

          {

              modification = new SPWebConfigModification(ElementName + CreateAttributeString(Attributes), XPathLocation);

              modification.Owner = “Company.MOSS.FeatureReceiver”;

              modification.Sequence = 0;

              modification.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;

              modification.Value = string.Format(CultureInfo.InvariantCulture, CreateModificationValueString(ElementName, Attributes), CreateModificationValueArgs(Attributes));                     

          }

          else

          {

              modification = new SPWebConfigModification(SectionName, XPathLocation);

              modification.Owner = ” Company.MOSS.FeatureReceiver”;

              modification.Sequence = 0;

              modification.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureSection;

              modification.Value = String.Format(“<{0}/>”, SectionName);

          }

           

          if (removeModification)

              webApp.WebConfigModifications.Remove(modification);

          else

              webApp.WebConfigModifications.Add(modification);

webApp.Farm.Services.GetValue<SPWebService>().ApplyWebConfigModifications();

}

else

throw new ApplicationException(“Could not locate a web application”);

}

catch (Exception ex)

{

System.Diagnostics.EventLog el = new System.Diagnostics.EventLog();

el.Source = “WebConfigFeature”;

el.WriteEntry(ex.Message);

}

}

/// <summary>

/// Accepts a dictionary object with all of the attributes for the web modification and

/// creates a string representing the attribute values which can be used when creating

/// the SPWebConfigModification object.

/// </summary>

/// <param></param>

/// <returns></returns>

private string CreateAttributeString(Dictionary<string, string> Attributes)

{

//Create a string that looks like this (no line breaks):

//[@Assembly=\”Company.Moss.Activities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9eed2245513232a4\”]

//[@Namespace=\”Company.Moss.Activities\”]

//[@TypeName=\”*\”][@Authorized=\”True\”]

string result = “”;

//Check if there are attributes

if (Attributes.Count > 0)

{

foreach (KeyValuePair<string, string> kvp in Attributes)

{

result += “[@” + kvp.Key + “=\”” + kvp.Value + “\”]”;

}

}

return result;

}

private string CreateModificationValueString(string ElementName, Dictionary<string, string> Attributes)

{

//Create a string that looks like this:

//”<authorizedType Assembly=\”{0}\” Namespace=\”{1}\” TypeName=\”{2}\” Authorized=\”{3}\”/>”

string result = “<” + ElementName;

//Check if there are attributes (Kind of silly if there aren’t!)

if (Attributes.Count > 0)

{

int i = 0;

foreach (string key in Attributes.Keys)

{

result += ” ” + key + “=\”{” + i.ToString() + “}\””;

i++;

}

}

result += ” />”;

return result;

}

private object[] CreateModificationValueArgs(Dictionary<string, string> Attributes)

{

//Create an object that looks like this:

//”Company.Moss.Activities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9eed2245513232a4″, “Company.Moss.Activities”, “*”, “True”

object[] result = new object[Attributes.Count];

int i = 0;

foreach(string value in Attributes.Values)

{

result[i] = value;

i++;

}

return result;

}

Here is the sample WebConfigChanges.xml file with connectionStrings section and other elements.

<?xml version=”1.0″ encoding=”utf-8″ ?>

<WebConfigChanges>

<WebConfigChange XPathLocation=”configuration” SectionName=”connectionStrings”>

</WebConfigChange>

<WebConfigChange XPathLocation=”configuration/connectionStrings” ElementName=”add”>

<Attributes>

<Attribute Name=”name” Value=”MOSSConnectionString” />

<Attribute Name=”connectionString” Value=”Data Source=XXX;Initial Catalog=XXX;User; Password=XXX” />

<Attribute Name=”providerName” Value=”System.Data.SqlClient” />

</Attributes>

</WebConfigChange>

<WebConfigChange XPathLocation=”configuration/system.web/httpHandlers” ElementName=”add”>

<Attributes>

<Attribute Name=”verb” Value=”*” />

<Attribute Name=”path” Value=”ChartImg.axd” />

<Attribute Name=”type” Value=”System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />

</Attributes>

</WebConfigChange>

</WebConfigChanges>

Remember to place this file in the folder where elements.xml of the feature file is located under the 12 hive.

August 26, 2014

SharePoint search – The content processing pipeline failed to process the item

Filed under: SharePoint 2013 — Veera Kanithi @ 4:46 pm

Lot of times I have seen the error “The content processing pipeline failed to process the item. ( Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index; ; SearchID = xxx)” in search crawl logs especially when crawling Documents and List Items.

After a quick search, many sites pointed to rebuild the Search Service Application. It may fix the issue but that’s not the root cause.

In my case, the problem is with the improper Managed Property setting. I set the Allow multiple values to True of a Managed Property but the Site Column  does not accept multiple items.

Set the property to False and run full crawl, no more error.

Also do not set Allow Multiple Values on SecondaryFileExtension property, that could cause several issues.

March 13, 2014

Approval workflow does not update the approval status of items

Filed under: SharePoint 2013 — Veera Kanithi @ 5:23 pm

There seems to be an issue with Approval Workflow (Approval – SharePoint 2010) in setting the Content Approval status to Approved on Item Changed when you set the option of Enable Content Approval (Update the approval status after the workflow is completed (use this workflow to control content approval)).

This is a known issue with SharePoint 2010 Approval workflow: http://support.microsoft.com/kb/2908491

Microsoft suggests to not use “Changing an item will start this workflow” as one of the Start Options, but that will not kick Approvals on Item Updates.

Following instructions will create a new (modify) existing Approval workflow to workaround the issue.

  1. Right click on the workflow and do “Copy and Modify”, rename the new workflow, mine I named it as “Approval (Modified) – SharePoint 2010”
  2. Edit the new Workflow and click on the “Approval Workflow Task Copy”, rename it, click on “Change the behavior of the overall task process”          image
  3. When you look at the Task actions, there are 4 places where it sets the Content Approval status
  4. If you look at the conditions where it sets the Content Approval Status, there is a check for Start on Item Change to see if it is not set, all we have to do is Delete the whole condition and set the Approval Status as shown below
  5. image  to image
  6. This needs to be done in 3 stages, “When the Task Process Starts”, “When the Task Process is Canceled”, “When the Task Process Completes” – 2 places here
  7. Since the condition that checks for Content Approval option on Association Form was removed, you may want to remove the following parameter from Initiation Form Parameters and change the InfoPath Form.
  8. image
  9. Also we have to change the action that sets the content approval as workflow author, instead use the “Set Content Approval Status” action as shown image to image
  10. Above step needs to be done in all 4 places as done in step 6
  11. Save and Publish the workflow, test it out…

 

On a separate note, you might see an error depending on your environment when publishing “Unexpected error on server associating the workflow”

image

This is a known issue with SharePoint designer 2010 and applies to 2013 as well as the workflow exceeded max complexity (number of steps)

http://support.microsoft.com/kb/2557533

July 27, 2012

My Initial Analysis on SharePoint 2013

Filed under: SharePoint 2013 — Tags: — Veera Kanithi @ 3:29 pm

 

SharePoint 2013 Beta is finally here, so it’s time to get the hands dirty. Here are my initial analysis on the exciting new SharePoint 2013.

Environment

When it comes to Environment, SP 2013 only works on .NET 4.0 and also supports .NET 4.5. There are significant changes in 2013 Workflows.

2013 Workflow engine should only run on Windows Workflow Azure Services, it can have it’s own Farm but not on SharePoint Farm.

Also the SP files are in 15 hive.

Central Admin

Central Admin site in SP 2013 looks almost same, except there is a new concept “Apps” and has it’s own settings.

image

Unlike 2010 Farm or Sandbox solutions, App code is totally isolated from SharePoint. App either it should have complete client side code (Java Script) or if using server code then it should be hosted on its own environment.

UI

image

“Focus on Content” – To really make emphasis on the main content, eliminating top, left frames

There are some changes with the ribbon space, it automatically expands when you click on Files or Library at the top, instead of occupying the very important space when just browsing.

Publishing

There are some really cool settings on Publishing Sites to change the look.

image

April 5, 2011

My Experience with Visio Services/Workflow Visualization

Filed under: SharePoint 2010 — Veera Kanithi @ 10:00 pm

Here are my findings or thoughts on SharePoint Workflow with Visio Visualization so far…

Visio Graphics Service

SharePoint 2010 now offers Workflow Visualization using Visio 2010 and Visio Services. Before starting on using Visualization, you must have the Visio Graphics Service proxy running in the Farm, Otherwise you may see the error “There are no addresses available for this application.” as shown below

image

Some times even if you Start the Visio Services, you may see the above error, either have patience till worker process gets recycled or simple IISRESET on the server would work.

Visio 2010 Premium

Visio 2010 Premium has SharePoint stencils to create a simple SharePoint workflow, but this can only create basic flow and can not publish directly to SharePoint. Once you are done with Workflow you must Export to a VWI (Visio Workflow Interchange) file to further process in SharePoint designer as shown below.

image           image                    image

Using Visio Premium is not necessary to create Workflow Visualization as SharePoint designer is the utility that does create final diagram, however Its always best practice to use Visio first to have a skeleton of process if available.

Visio Workflow Interchange

What does VWI file contains, its basically like any other MS office file, its a ZIP file containing VDX(Visio Drawing), XOML (Main Workflow File), XOML.RULES(Stores all conditions and rules), XOML.WFCONFIG.XML(Configuration File). At this point XOML will only contains the basic flow. All these files will be used when you import the VWI to SharePoint designer. Take a look at any saved VWI file by adding .ZIP at the end.

image

If you see carefully VDX is the final file that will be displayed in the SharePoint site under Workflow Visualization

SharePoint Designer 2010

Once you have the VWI file, you need to import it using image

Now you can Edit the Workflow, here all the you might see various Steps and some Activities based on your Visio workflow. Most of the Activities in Visio will be converted as Activity holder with description of what that should do. These descriptions are very useful in the final diagram it creates as shown below.

image   –>  image

All these descriptions are stored as “ShapeText” under Description Attribute of the Element in XOML file. So if in any case, you have to add more descriptions in SharePoint designer, unfortunately you have to change the XOML file.

So what ever the changes you will make in the SPD, it will create a new VDX file (Visio Diagram). To do this you must set the Workflow property “Show workflow visualization on status page” and Visio Graphics Service running.

image

Changing workflow XML files

Workflow specific files such as XOML, XOML.RULES, xoml.wfconfig.xml can be changed from SPD but have to be careful.

You can always what are the files stored under the workflow from All Files section as shown below

image

XOML.WFCONFIG.XML file is the configuration file that contains configuration information about the workflow, like references to all XML files with version. When ever you change any of these XML file a new version will be created automatically. If you make any modifications in XOML  of V1.0, then your changes will be stored in server as V2.0, but the configuration file still refers the old XOML file unless you change it.

You might see this error “Visio Services was unable to load this Web Drawing……..” if the config xml is referring to the XOML version which is not available in the server.

image

One more important thing to consider when you are making changes to XOML file, SharePoint designer caches workflow data, so if you change the XOML file and open back in SPD it will not show your modifications unless you close the Site and re open it.

Understanding Configuration file (xoml.wfconfig.xml)

Here are the important attributes of the Config xml file

XomlHref : XOML File Name; XomlVersion: Version of the XOML file; RulesHref: XOML.RULES file; RulesVersion: Version of the Rules File; PreviewVersion: Current Visio Diagram Version; PreviewHref: Visio Diagram;

Note: Check this article on how to move the Workflow between lists

March 7, 2011

Calling a SharePoint page from Report Viewer web part using SP Dialog box

Filed under: SharePoint 2010 — Veera Kanithi @ 9:03 pm

If you are using a Report Viewer web part to show a SSRS report either in Native or Integrated mode and want to open a page in modal dialog box, i think its easy to use SP ModalDialog property and it looks much better in Share Point 2010.

In the report designer, under Placeholder properties of any text, add the following Expression for Action property

="javascript:void(SP.UI.ModalDialog.ShowPopupDialog(‘/SitePages/Test.aspx’))"

Its as simple as this, this will open the new page in a Share Point way. But make sure that Test.aspx is either an Application page or a ASPX page not any Web Part page that requires a Ribbon control, otherwise you might see this error below.

The Ribbon Tab with id: "Ribbon.Read" has not been made available for this page or does not exist.
Use Ribbon.MakeTabAvailable().

November 1, 2010

How to set permissions on Business Data Connectivity entities dynamically (Programmatically) in SP 2010

Filed under: SharePoint 2010 — Veera Kanithi @ 8:41 pm

Setting permissions on individual BDC entities using Central Admin in SharePoint 2010 is a big pain especially if there are several entities and several users/groups involved.

Following is the code based solution (Visual Studio) that will set permissions on certain BDC entities. We can either create a small Windows Project or put this in Feature receiver.

//Create Service Context Object ; site – is the SPSite Object , if using feature receiver , use SPFeatureReceiverProperties

SPServiceContext spc = SPServiceContext.GetContext(site);
BdcServiceApplicationProxy proxy = (BdcServiceApplicationProxy)spc.GetDefaultProxy(typeof(BdcServiceApplicationProxy)); //BDC proxy instance
AdministrationMetadataCatalog catalog = proxy.GetAdministrationMetadataCatalog(); //To administer the BDC service Metadata store
//Loop through the entities that  match wild card NameSpace (Custom) and wild card entity name (AdventureWorks) with active only

foreach (Entity entity in catalog.GetEntities("*Custom*", "*AdventureWorks*", true))
         {
            IAccessControlList acl = entity.GetAccessControlList();
           //Set access Execute, Edit, SelectableInClients and SetPermissions to Domain\Admin user

          acl.Add(new IndividualAccessControlEntry(BdcAccessControlList.TranslateFriendlyStringToEncodedClaim("Domain\\Admin"), BdcRights.Execute | BdcRights.Edit | BdcRights.SelectableInClients | BdcRights.SetPermissions));
          acl.Add(new IndividualAccessControlEntry(BdcAccessControlList.TranslateFriendlyStringToEncodedClaim("Domain\\Group1"), BdcRights.Execute | BdcRights.Edit | BdcRights.SelectableInClients));
           acl.Add(new IndividualAccessControlEntry(BdcAccessControlList.TranslateFriendlyStringToEncodedClaim("Domain\\User1"), BdcRights.Execute | BdcRights.Edit ));
           acl.Add(new IndividualAccessControlEntry(BdcAccessControlList.TranslateFriendlyStringToEncodedClaim("Domain\\User2"), BdcRights.Execute ));
            entity.SetAccessControlList(acl); //Set the permissions

               //Copy entity permissions to its methods so that they can be executed by the added user
               entity.CopyAclAcrossChildren();

        }

You might want to wrap the whole code as a delegate and run using SPSecurity.RunWithElevatedPrivileges

Also make sure when ever setting permissions on BDC entities using code model, one of the permissions must include SetPermissions otherwise the error “An error occurred while trying to assign an Access Control List to ‘IEntity’ with name ‘****’. At least one user/group in the Access Control List must have the SetPermissions right to avoid creating a non-manageable object.” is thrown.

September 10, 2010

Important points to consider while developing in SharePoint 2010

Filed under: SharePoint 2010 — Veera Kanithi @ 2:00 pm
  • While updating external list with a workflow you may often get the error “The workflow could not create the item in the external data source. Make sure the user has permissions to access the external data source and create items.”. To avoid this, you must use Secure Store ID for the External Content Type, and the App Pool account for the content web application must be included as a member of that SSID. Also the app pool account must have permissions to the ECT entity in the BDC service application.
  • External lists are not flexible enough as compared to regular list when it comes to customization of forms with InfoPath. External list forms do not support additional data connections.
  • When ever you make changes to the BDC entity, it happens to lose the permissions on the BDC entity. You always have to set permissions.
  • Updater method in BCS modal never provides detailed and proper information in Trace logs if any error occurs, but Creator method always provides detailed information to the point. So do the Creator method first and correct any Data Type mismatches and then Updater should work fine.
  • In order to implement Update/Delete/Insert operations on an external list using BCS modal (code solution), the underlying table must have a Primary Key
Older Posts »

Blog at WordPress.com.