Eddy Blanco

Sharepoint Making Technology Simpler

test

without comments

Written by eddyblanco

May 31st, 2009 at 4:11 pm

Posted in Uncategorized

SharePoint 2010 requirements

without comments

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

 

Link

Written by eddyblanco

May 11th, 2009 at 9:22 pm

Posted in Uncategorized

WSS 3 /MOSS SP2 errors encounter

without comments

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

Written by eddyblanco

April 29th, 2009 at 1:36 pm

Posted in Uncategorized

Sending mail using c#

without comments

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
                {
                 
                }
            }
        }
    }
}

Written by eddyblanco

March 5th, 2009 at 11:21 am

Posted in Uncategorized

Warning: Importing Group “Group Name”

without comments

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

Written by eddyblanco

February 28th, 2009 at 2:37 pm

Posted in Uncategorized

ESP For SharePoint Announced!

without comments

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

Link

Written by eddyblanco

February 10th, 2009 at 3:36 pm

Posted in Uncategorized

SPDisposeCheck Released

without comments

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

Link

Written by eddyblanco

January 31st, 2009 at 8:44 am

Posted in Uncategorized

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

without comments

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.

Written by eddyblanco

January 23rd, 2009 at 3:03 pm

Posted in Uncategorized

Visual Studio 2008 extensions for SharePoint 1.3

without comments

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

Written by eddyblanco

January 18th, 2009 at 10:36 pm

Posted in Uncategorized

Happy New Year

without comments

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.

Written by eddyblanco

January 1st, 2009 at 6:08 pm

Posted in Uncategorized

Alerts are not working

without comments

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

Written by eddyblanco

December 28th, 2008 at 8:54 am

Posted in Uncategorized

Sub site to use navigation from parent site

without comments

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;

Written by eddyblanco

November 10th, 2008 at 11:13 am

Posted in Uncategorized

Office 14 rumors

without comments

Written by eddyblanco

October 24th, 2008 at 9:32 am

Posted in Uncategorized

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

without comments

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();
                            }
 
                        }
                    }
                }
            }
 
        }
       
 
    }

Written by eddyblanco

October 23rd, 2008 at 10:12 pm

Posted in Uncategorized

MOSS: Goodbye 2000 limit, Hello 3000?

with 2 comments

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…

Written by eddyblanco

September 27th, 2008 at 7:18 pm

Posted in Uncategorized

The Passing of Patrick Tisseghem

without comments

I just read that Patrick Tisseghem, one of the most remarkable persons in the SharePoint community, has passed away. Patrick leaves a huge global footprint in the community, and he will be remembered. I’d like to express my deepest condolences to his family, friends and the entire U2U team.

Patrick, you will be missed.

Written by eddyblanco

September 7th, 2008 at 7:58 am

Posted in Uncategorized

Windows Server 2008 improvements

without comments

Some of the improvements in the Windows 2008 operating system are:

  • RPC Asynchronous Pipe vs. Multiple RPC Calls in Windows Server 2003 R2
  • Asynchronous I/Os vs. Synchronous I/Os in Windows Server 2003 R2
  • Unbuffered I/Os vs. Buffered I/Os in Windows Server 2003 R2
  • Low Priority I/Os vs. Normal Priority I/Os in Windows Serve 2003 R2
  • 16 Concurrent File Downloads vs. 4 Concurrent File Downloads in Windows Server 2003 R2

Written by eddyblanco

August 30th, 2008 at 10:04 am

Posted in Uncategorized

Code For Uploading File to Document Library

with 2 comments

If you need to upload files to a SharePoint document library programmatically the following code accomplishes that need.

SPSite site = new SPSite(URL);
SPWeb web = site.OpenWeb();
web.AllowUnsafeUpdates=true;
string path =”"; 
string []fileName =filePath.PostedFile.FileName.Split(’\\’);
int length = fileName.Length;

string file=fileName[length-1];

SPFolder folder = web.GetFolder(LibraryName);
SPFileCollection files=folder.Files;

Stream fStream = filePath.PostedFile.InputStream;

byte[] MyData= new byte[fStream.Length];
fStream.Read(MyData, 0, (int)fStream.Length);
fStream.Close();
SPFile fff= files.Add(file,MyData);
web.AllowUnsafeUpdates=false;

Written by eddyblanco

August 30th, 2008 at 9:57 am

Posted in Uncategorized

Surfing back home

without comments

The picture below is me surfing in Melbourne Florida about 2 months ago.

 edd.jpg

Written by eddyblanco

August 15th, 2008 at 7:13 pm

Posted in Uncategorized

InfoPath Insert value to Sharepoint List

without comments

I’ve working on infopath recently. I had to insert a value via code to a sharepoint list and here in how I did it.

XPathNavigator xnDoc = this.MainDataSource.CreateNavigator();

            //Create a Navigator object for the field that you want to set.
            XPathNavigator TitleDescription = xnDoc.SelectSingleNode(”/my:Baseline_Change_Request/my:TitleDescription”, this.NamespaceManager);
            XPathNavigator XMLFileName = xnDoc.SelectSingleNode(”/my:Baseline_Change_Request/my:CR_File_Name”, this.NamespaceManager);
          

            //Remove the “nil” attribute.
            if (TitleDescription.MoveToAttribute(”nil”, “http://www.w3.org/2001/XMLSchema-instance“))
                TitleDescription.DeleteSelf();

            //Set the value of the TitleDescriptionField field.
            TitleDescription.InnerXml.ToString();
            XMLFileName.InnerXml.ToString();
            string TitleDescriptionSet = TitleDescription.InnerXml.ToString();
            string XMLFileNameSet = XMLFileName.InnerXml.ToString();

 

            SPSListWeb.Lists listService = new SPSListWeb.Lists();
            DataSet ds = new DataSet();

            /*Authenticate the current user by passing their default
            credentials to the Web service from the system credential cache.*/
            listService.Credentials = System.Net.CredentialCache.DefaultCredentials;
            listService.PreAuthenticate = true;

            /*Set the Url property of the service for the path to a subsite.*/
            listService.Url = “http://xxxxxx/_vti_bin/lists.asmx“;
            listService.PreAuthenticate = true;

            /*Get Name attribute values (GUIDs) for list and view. */
            System.Xml.XmlNode ndListView = listService.GetListAndView(”One Title”, “”);
            string strListID = ndListView.ChildNodes[0].Attributes[”Name”].Value;
            string strViewID = ndListView.ChildNodes[1].Attributes[”Name”].Value;

            /*Create an XmlDocument object and construct a Batch element and its attributes. Note that an empty ViewName parameter causes the method to use the default view. */
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            System.Xml.XmlElement batchElement = doc.CreateElement(”Batch”);
            batchElement.SetAttribute(”OnError”, “Continue”);
            batchElement.SetAttribute(”ListVersion”, “1″);
            batchElement.SetAttribute(”ViewName”, strViewID);

 

          
            XmlDocument documentQuery = new XmlDocument();
            XmlElement query = documentQuery.CreateElement(”Query”);
            System.Xml.XmlElement viewFields = documentQuery.CreateElement(”ViewFields”);
            // The CAML query to return what I’m looking for.
            query.InnerXml = ” <Where>” +
                   “<Eq>” +
                      “<FieldRef Name=\”Title\” />” +
                      “<Value Type=\”Text\”>” + TitleDescriptionSet + “</Value>” +
                   “</Eq>” +
             “</Where>”;

            string ListName = “BCR Title”;

            XmlNode ndResult = listService.GetListItems(ListName, null, query, viewFields, “10″, null, null);

              
            XmlTextReader rdr = new XmlTextReader(ndResult.OuterXml, XmlNodeType.Document, null);
             
                ds.ReadXml(rdr);
                ArrayList array = new ArrayList();
                if (XMLFileNameSet == “CR_New”)
                {
                    XMLFileNameSet = “No file”;
                    batchElement.InnerXml = “<Method ID=’1′ Cmd=’New’>” +
                        “<Field Name=’Title’>” + XMLFileNameSet + “</Field>” +
                        “<Field Name=’Description’>” + TitleDescriptionSet + “</Field></Method>”;
                    /*Update list items. This example uses the list GUID, which is recommended, but the list display name will also work.*/
                    listService.UpdateListItems(strListID, batchElement);
                }
               
                if (ds.Tables.Count > 1)
                {
                    DataTable dt = ds.Tables[1];
                    foreach (DataRow dr in dt.Rows)
                    {
                        string UpdateID = dr[”ows_ID”].ToString();
                        batchElement.InnerXml = “<Method ID=’1′ Cmd=’Update’>” +
                        “<Field Name=’ID’>” + UpdateID + “</Field>” +
                        “<Field Name=’Title’>” + XMLFileNameSet + “</Field>” +
                        “<Field Name=’Description’>” + TitleDescriptionSet + “</Field></Method>”;
                        /*Update list items. This example uses the list GUID, which is recommended, but the list display name will also work.*/
                        listService.UpdateListItems(strListID, batchElement);
                                        
                       
                    }
                }

            //Clean up.
            xnDoc = null;
            TitleDescription = null;

Written by eddyblanco

August 15th, 2008 at 6:49 pm

Posted in Uncategorized