BDC Service Application Throttle Settings in SharePoint 2010

If the throttle limit is exceeded, end users will received a message with the following “Unable to display this web part” following with the correlation ID.
You could either modify the throttle with a specified max return or turn off.

To Turn Off
1.
$bdcProxy = Get-SPServiceApplicationProxy | where {$_.GetType().FullName -eq (‘Microsoft.SharePoint.BusinessData.SharedService.’ + ‘BdcServiceApplicationProxy’)}
2.
$dbRule = Get-SPBusinessDataCatalogThrottleConfig -Scope Database -ThrottleType Items -ServiceApplicationProxy $bdcProxy
3.
Set-SPBusinessDataCatalogThrottleConfig -Identity $dbRule -Enforced:$false

To Modified

1.
Add-PSSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$bdc = Get-SPServiceApplicationProxy |
Where {$_ -match “Business Data Connectivity”}

2.
$throttle = Get-SPBusinessDataCatalogThrotteConfig
-ThrottleType Items -Scope Database -ServiceApplicationProxy $bdc

3.
Set-SpBusinessDataCatalogThrottleConfig -Maximum 10000
-Default 8000 -Identity $Throttle

Developers DashBoard in Sharepoint 2010

In order to enable the dashboard run the following PowerShell command

 

To enable:

$dash = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$settings = $dash.DeveloperDashboardSettings
$settings.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::OnDemand
$settings.Update()

To disable it:

$dash = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$settings = $dash.DeveloperDashboardSettings
$settings.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::Off
$settings.Update()

Project Server 2010 Installation

During the installation of Project Server 2010 there are a few items that should be considered, one of them been the Common Language Runtime which increases the performance by 20%

sp_configure ‘clr enabled’ , 1;
go
Reconfigure;
go

How to copy files across SharePoint libraries.

Yesterday, I was working on a SharePoint Workflow. I needed to copy the final InfoPath (xml) to a different library. My first thought was to use the spfile.copyto but that gave me the “Value does not fall within the expected range.” or COM errors.
Instead of wasting my time trying to figure out how to make the copyto  method copy across site collections, I did the following.
   

SPFile file = workflowProperties.Item.File;
string xmlFileContent = System.Text.Encoding.Default.GetString(file.OpenBinary());
int index = xmlFileContent.IndexOf(”<?xml”);
if (index != 0)
    xmlFileContent = xmlFileContent.Remove(0, index);
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlFileContent);
XmlNamespaceManager mgr = new XmlNamespaceManager(doc.NameTable);
mgr.AddNamespace(”my”, @”http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-10-05T17:30:02”

 I needed to set the status before I move to the new location.

XmlNode nodeStatus = doc.DocumentElement.SelectSingleNode(”/my:myFields/my:FormStatus”, mgr);
nodeStatus.InnerText = status;
char[] newFile = doc.InnerXml.ToCharArray();
file.SaveBinary(System.Text.Encoding.Default.GetBytes(newFile));
Stream s = file2.OpenBinaryStream();
SPFolder target = curweb.GetFolder(”Contract”);
SPFile ofile = curweb.GetFile(”Contract/” + _requestName + “.xml”);
if (ofile.Exists)
    ofile.Delete();
target.Files.Add(_requestName + “.xml”, s);
fileURLWorkSpace = thedestinationlocation-URL + _requestName + “.xml”;
target.Update(

 Hope this helps someone.

Installing the PWA site for Sharepoint

The process to install an instance of Project Server 2007 and the PWA site required a several steps. Please follow the instructions below.

First we have to make sure that the “Project Application Services” is running.

Open the SharePoint Central Administration website and select the “Operations” tab under Topology and services select “Services on Server”. Select “Project Application” and start the “Project Application Service” if is stop.

In order to install the PWA site do the following

Open the SharePoint Central Administration website. Select SharedServices1 or the name of your SSP link in the left menu. Then select

admin-01

Then Click on the “Project Web Access Site” under Project Server heading.

admin-03

Under the “Manage Project Web Access Site” Click the Create Project Web Acess Site button.

admin-04

On the Create Project Web Access Site page, enter the following information, then click the OK

 

SharePoint Web Application to host Project Web Access: <The Name of the website>

Project Web Access path: PWA

Administrator account: <Account>

Primary Database:

Primary database server: <Server Name>

Published database name: Default is <ProjectServer_Published>

Draft database name: Default is <ProjectServer_Draft>

Archive database name: Default is <ProjectServer_Archive>

Reporting Database:

Use the primary database server: Yes

Reporting database name: Default is  <ProjectServer_Reporting>

At the end is going to take a few minutes to create the PWA site and DB’s. Click on refresh tilt you see “Provisioned” Once is completed the PWA site is ready.

Planning for SharePoint 2010 - Upgrade Planning and Guidance

This is a series of White Papers that have been published by Microsoft before the reveal of Sharepoint 2010 at Sharepoint Coference 2009.   

Microsoft SharePoint Server 2010 Upgrade Planning
Microsoft SharePoint Server 2010 — Test Your Upgrade Process
Microsoft SharePoint Server 2010 — Services Upgrade

SharePoint 2010 requirements

Microsoft just announced the Sharepoint 2010 preliminary system requirements. From this point on only 64bit of Sharepoint and SQL are supported.

 

Link

WSS 3 /MOSS SP2 errors encounter

After installing WSS 3 SP2 I encounter the following error.

Server error: http://go.microsoft.com/fwlink?LinkID=96177
I try the following and nothing happened, after started changing the version number in the SQL DB and that broke the entire solution.
USE master;
GO
EXEC sp_configure ’show advanced option’, ‘1′;
RECONFIGURE WITH OVERRIDE;
EXEC sp_configure;
psconfig -cmd upgrade
stsadm -o upgrade –forceupgrade -inplace
stsadm -o upgrade -url http://laptopdev -inplace –forceupgrade

At this point I try the “Sharepoint products and technologies configuration”  and created a new Config DB , reinstall the entire and then restore the old DB
stsadm.exe -o addcontentdb -url http://laptopdev:80 -databasename WSS_Content -databaseserver laptopdev

Sending mail using c#

The simple program will send emails at the end of the month.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;

namespace SendEmailLastDayofMonth
{
    class Program
    {
        static void Main(string[] args)
        {
            DateTime lastDayofMonth = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.DaysInMonth(DateTime.Today.Year,DateTime.Today.Month));

            if(DateTime.Today == lastDayofMonth)
            {
                try
                {

                    MailMessage mM = new MailMessage();
                    mM.From = new MailAddress(”eddyblanco@gmail.com“);
                    mM.To.Add(”eddyblanco@gmail.com“);
                    mM.Subject = “Text Subject”;
                    mM.Body = “The body of the email”;
                    mM.IsBodyHtml = true;
                    mM.Priority = MailPriority.High;
                    SmtpClient sC = new SmtpClient(”smtp.mail.eddyblanco.com”);
                    sC.Send(mM);
                  

                }
                catch
                {
                 
                }
            }
        }
    }
}

Warning: Importing Group “Group Name”

Today in the process of a SharePoint migration I encounter several Warnings in the logs. Warning: User or group xxxx cannot be resolved.

The problem is every security group that has the ID’s with the warning above do not come over on the import, which shows up as a warning in the import log as.

Warning: Importing Group <Group Name>

The SQL query below when run on the content DB will return all groups that have the owner ID’s specified in the warning.

select * from groups with (nolock) where owner = XXXX

ESP For SharePoint Announced!

Article by Michael Gannotti on the announcement of ESP for SharePoint.

Link

SPDisposeCheck Released

PDisposeCheck for SharePoint Developers has been released. SPDisposeCheck inspect your SharePoint assemblies to make sure you are code is disposing correctly

Link

stsadm restore Results “No content databases are available for this operation”

The reason for the problem is that the GUID is the same as an existing site. You could either delete the old site or create a new web application and restore in that new one.

Visual Studio 2008 extensions for SharePoint 1.3

The Community Technology Preview release for Visual Studio 2008 extensions for SharePoint 1.3 is now publicly available on Microsoft Connect.

The CTP is available at: https://connect.microsoft.com/site/sitehome.aspx?SiteID=428

New Features in VSeWSS 1.3

  • The extensions now install on x64 bit OS. Visual Studio 2008 and SharePoint must be already installed.
  • Command Line Build option for TFS and MSBuild integration
  • Separate WSP Package and Retract commands. You can now build the WSP without deploying it
  • SPSolGen to Support Exporting from Content Management Publishing Sites
  • New Item Template for RootFiles Deployment
  • Automatically Remove conflicting existing features on development SharePoint server
  • WSP View New Feature Dialog Improvements: scope, receiver checkbox, element checkbox
  • WSP View can now be used to merge features and it blocks site features being merged into web features
  • Allow adding separate binary files such as Workflow assemblies
  • Some refactoring allowing for Web Part renaming and removing lines from feature.xml Item Removed
  • Allow selection of GAC or BIN deployment for Web Part Project not including CAS generation
  • Increase visibility of hidden features that VSeWSS creates
  • Add fast update deploy for DLL only or file only changes to solutions
  • Numerous Bug Fixes and improvements to error messages

Happy New Year

I spent most of this year doing SharePoint development and Architecture. My role at my company will probably continue along that path and perhaps even more so.

Resolutions for 2009

Spend more time outside and SharePoint of course.

Alerts are not working

If your alerts stop working below you will find the solution that works for me. Also I have created a custom handler to take care of the 70 character

stsadm -o updatealerttemplates -url -f “c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML\alerttemplates.xml” -LCID 2057″

  1. stsadm -o setproperty -propertyname alerts-enabled -propertyvalue false -url
  2. stsadm -o setproperty -propertyname alerts-enabled -propertyvalue true -url
  3. stsadm -o setproperty -propertyname job-immediate-alerts -propertyvalue “every 5 minutes”  -url

Sub site to use navigation from parent site

In order to use the navigation from the parent site. The following code would help with that.

SPSite SiteCollection = new SPSite(http://laptopdev/eddy);

SPWeb Webopenme = SiteCollection.OpenWeb();

Webopenme.allowunsafeupdates = true;

Webopenme.Navigation.UseShared = true;

Office 14 rumors

Click to read

Adding a New Group and users to group just created (All Site collections and sub webs)

I needed to add a group and several users to all site collections in a farm that consisted of 4000+ site collections and 20+ terabytes. This users would be a part of an administration group that could view and manage the collections. In order to add the users I use the spfarm class.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
 
 
namespace AddUser
{
   
    class Program
    {
     
        static void Main(string[] args)
        {
            //Add all the users that will be included on the group
            string[] username =
            {   
                “laptopdev/jim”,
                “laptopdev/administrator”
                
            };
            // Get a reference to the local farm
            SPFarm oFarm = SPFarm.Local;
 
            // Loop through the services in the farm
            foreach (SPService oService in oFarm.Services)
            {
                // See if this service is a SPWebService
                if (oService is SPWebService)
                {
                    // Cast into a SPWebService
                    SPWebService oWebService = (SPWebService)oService;
 
                    // Loop through the web applications in the web service
                    foreach (SPWebApplication oWebApplication in oWebService.WebApplications)
                    {
                        foreach (SPSite oSite in oWebApplication.Sites)
                        {
                            // Get the root web object
                            SPWeb oWebRoot = oSite.RootWeb;
 
 
                            SPRoleDefinition readDef = oWebRoot.RoleDefinitions["Read"];
                            SPRoleDefinition contributeDef = oWebRoot.RoleDefinitions["Contribute"];
                            SPRoleDefinition admins2 = oWebRoot.RoleDefinitions["Full Control"];
                            SPRole admins = oWebRoot.Roles["Full Control"];
 
                            string FBARoleProviderPrefix = “CustomRoleProvider”;
 
                            string newGroupName = “Test”;
 
 
 
                            foreach (SPGroup spGroup in oWebRoot.Groups)
                            {
                                //if the group we want to add does not already exist, create it at the top level and make
                                //the owner the top level owners group.
                                if (!oWebRoot.SiteGroups.Xml.Contains(string.Format(”Name=\”{0}\”", newGroupName)))
                                    oWebRoot.SiteGroups.Add(newGroupName, oWebRoot.SiteAdministrators[0], null, “This is for administrator for all sites” + newGroupName);
 
                            }
 
                            try
                            {
                             
                                SPGroup newGroup = oWebRoot.SiteGroups[newGroupName];
                              
                                newGroup.AllowMembersEditMembership = true;
                                SPRoleAssignment spRoleAssignment = new SPRoleAssignment(newGroup);
                                SPRoleDefinition role = oWebRoot.RoleDefinitions["Full Control"];
                                spRoleAssignment.RoleDefinitionBindings.Add(role);
                                oWebRoot.RoleAssignments.Add(spRoleAssignment);
                                oWebRoot.Update();
                                foreach (string UserName in username)
                                {
                                    SPUser oUser = oWebRoot.AllUsers[UserName];
                                    newGroup.AddUser(oUser);
                                    newGroup.Update();
                                }
 
 
 
                                // Be sure to dispose the SPSite and SPWeb objects for memory cleanup
                                oWebRoot.Dispose();
                                oSite.Dispose();
                            }
                            catch { }
 
 
                            //Do the same for all the subsites under a site collection.
                            //Add Full Control to the group
                            foreach (SPWeb subWeb in oWebRoot.Webs)
                            {
                                SPGroup newGroupSubWeb = oWebRoot.SiteGroups[newGroupName];
                                SPRoleAssignment spRoleAssignmentSubWeb = new SPRoleAssignment(newGroupSubWeb);
                                SPRoleDefinition roleSubWeb = oWebRoot.RoleDefinitions["Full Control"];
                                spRoleAssignmentSubWeb.RoleDefinitionBindings.Add(roleSubWeb);
                                subWeb.RoleAssignments.Add(spRoleAssignmentSubWeb);
                                subWeb.Update();
                            }
 
                        }
                    }
                }
            }
 
        }
       
 
    }

MOSS: Goodbye 2000 limit, Hello 3000?

The rule of thumb for SharePoint lists has always been “no more than 2000 items in a given container”.

Now in the recently released White Paper “SharePoint Performance Optimization - How Microsoft IT Increases Availability and Decreases Rendering Time of SharePoint Sites”, the following is stated in the Best Practices section:

Manage large lists for performance  
Having large lists by itself is not necessarily a performance issue. When SharePoint Server renders the many items in those lists, that can cause spikes in render times and database blocking. One way to mitigate large lists is to use subfolders and create a hierarchical structure where each folder or subfolder has no more than 3,000 items.”

The 2000 items was always a soft limit, of course, but interesting to see MS now saying 3000…