Dev Team Assemble

Evil beware!
Add to Technorati Favorites

Archive

Tag: SharePoint

I often find in my sharepoint development environments that I have issues with transaction logs filling up. This gives me the "Error" page with no indication of what the problem is...yes I can go and change the <customErrors> tag to set the customer errors mode to off and add the callstack to the page but it still doesn't address the problem. I whipped this script up because the dev sql server we are using has well over a hundred db's on it and I didn't fell like manually typing the ALTER DATABASE [xxx] SET RECOVERY SIMPLE for each one or doing the clickity click thing either. Now the solution below probably breaks lots of best practices and such but it works for what I wanted it to do....which is modify all existing db's recovery mode. To modify new db's recovery mode, just set the model db's option to simple and voila..you are ready to go.

Quick note: YOU PROBABLY DO NOT WANT TO EVER...I MEAN EVER...USE THIS ON A PRODUCTION SYSTEM.


*/

Modify th recovery model for all databases on your server

*/

DECLARE @lasterror int

DECLARE @sql nvarchar(max)

DECLARE @dbname nvarchar(100)

DECLARE @dbid int

DECLARE @recModel int

-- cycle the log

exec sp_cycle_errorlog

CREATE Table #dbInfo

(

database_id int NOT NULL,

dbName nvarchar(100) NOT NULL,

recoveryModel int

)

--SELECT database_id, [name], recovery_model FROM sys.databases order by database_id

SELECT TOP 1 @dbid = database_id FROM sys.databases where database_id > 4 ORDER BY database_id asc;

SELECT @dbname = [name] FROM sys.databases where database_id = @dbid;

SELECT @recModel = recovery_model FROM sys.databases where database_id = @dbid;

-- begin backup process

WHILE @dbid > 0

BEGIN

INSERT INTO #dbInfo (database_id, dbName, recoveryModel) VALUES (@dbid, @dbname, @recModel);

IF @recModel = 1

BEGIN

SELECT @sql = 'ALTER DATABASE [' + @dbname + '] SET RECOVERY SIMPLE'

EXEC sp_executesql @sql

SELECT @lasterror = @@ERROR

IF @lasterror <> 0

-- log the error to the message console

PRINT 'ERROR: Changing the recovery mode for database : ' + @dbname + ' with error number ' + CAST(@lasterror as nvarchar(25))

ELSE

PRINT 'Recovery mode changed to simple (3) for database : ' + @dbname

END

-- get a new record

SELECT @dbid = 0;

SELECT TOP 1 @dbid = database_id FROM sys.databases where database_id > 4 and

database_id NOT IN (SELECT DISTINCT x.database_id FROM #dbInfo x);

SELECT @dbname = [name] FROM sys.databases where database_id = @dbid;

SELECT @recModel = recovery_model FROM sys.databases where database_id = @dbid;

END

DROP Table #dbInfo

SELECT database_id, [name], recovery_model FROM sys.databases order by database_id

GO

Technorati Tags: , , , ,

Scenario: Forms Based Authentication on an external facing portal. Users are having trouble (as in not able too) uploading multiple documents at once.

This was a pretty easy fix....Enable Client Integration for the given website zone in Central Administration.

Technorati Tags: , , ,

So I was trying to restore a content db from production into my dev box the other day and got the following error:

Your backup is from a different version of Windows SharePoint Services and cannot be restored to a server running the current version. The backup file should be restored to a server with version '12.0.0.6510'

Ahh ok...so my dev box is out of sync no biggie, it was't a real pressing update anyway.  So I figured I would go back to my site to finish up some dev tasks and to my dismay....the site was gone.   Ummmm...hello?!?!?!

Turns out, the restore process (via 'stsadm -o restore -url http://omg.net -filename c:\arrggggh.bak') wipes out your content db.  Great so now I HAVE to update my dev box to the version of the production server (which isn't a bad idea...just rather make that choice myself!).

Here is a great resource for figuring out which updates you need:

http://sharepointadminwiki.com/display/SharePointAdministrationWiki/SharePoint+Versions

To determine your version of SharePoint go to Central Admin > Operation > Servers in Farm

HTH

Technorati Tags: , ,

So I was having a strange problem in SharePoint the other day trying to run a webservice from a client script.  Every time I called the service (in this case and .asmx in the layouts dir) it was doing nothing...no communication at all with the service.  What made this particularly strange is that this exact same setup was working fine for everyone else in my team...figures.

When I ran the web methods from the service page itself (which loaded just fine) I got the following error : Request format is unrecognized for URL unexpectedly ending in '/[webmethod_name]'. Didn't make sense...I checked my web configuration and compared it against the other people in my team and all was well.  I tried following Microsoft's recommendation of adding the following snippet to the system.web section of the config file.

<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>

All the above did was give me a 500 error.

After spending waaaaaaaaay to much time on the problem...a colleague of mine and I finally discovered that it was due to the Lower case rewrite inbound rule (converts the entire address to lower case).  Apparently webmethod names are case sensitive in the address bar (this was not a SharePoint problem)...the documentation is here on msdn:  http://msdn.microsoft.com/en-us/library/0c515353(VS.71).aspx

So turning off the rule and everything started to work again.

Technorati Tags: , ,

I was trying to install install SharePoint 2007 onto Windows 2008 r2 and was getting a strange error referencing KB article 962935. Funny enough this article is not live yet so it left me a little unhappy. Apprarently Microsoft does not support the distributed SP1 installation package of SharePoint for this version of the OS. Turns out Jei Li posting on his msdn blog detailing how to go about creating a slipstreamed installation for SP2 on this server Click here for the article. Basically the steps are (pretty much word for word from Jei Li's blog):

  • Install .Net Framework 3.5 SP1 in the features applet
  • Copy the installtion media contents to a folder on the computer (c:\install)
  • Download the WSS x64 SP package and the MOSS 2007 SP2 x64
  • Delete everything inside Updates folder in the install folder you setup.
  • Open a command prompt,  change directory to the folder you put the downloaded patches, and run the following two commands: 
    • wssv3sp2-kb953338-x64-fullfile-en-us.exe /extract:[Path to installation bits]\Updates /quiet
    • officeserver2007sp2-kb953334-x64-fullfile-en-us.exe /extract: [Path to installation bits]\Updates /quiet
  • Delete the wsssetup.dll filein the updates dir. This is a very important step so please don’t miss it.
  • If you also need the Cumulative Updates to be applied when install SharePoint, download the latest Windows SharePoint Services 3.0 and SharePoint Server 2007 Cumulative Update packages and extract them into Updates folder like step 4.
  • Your slipstream build of SharePoint Server 2007 is done!
  • Go and install it on your Windows Server 2008 R2 box, after the installation, the site version will show 12.0.0.6421 or possibly a higher version.

Please reference Jei Li's post for furthur instuctions.  I only posted all the steps here because things have a mysterious way of dissappearing or not appearing at all on Microsofts site.

After doing all of this everything seems to be fine...seems to be :)  

Links

Technorati Tags: , , , , ,

One of the things I was working on today was trying to get an actual image from the library was that initially I was expecting to get a PublishingImage.  All the samples on MSDN and the ones strewn about the web refer to using the ImageFieldValue and getting it from a field in the SPListItem.  Like outlined on MSDN :

  // Retrieve the current value from an SPListItem with a
  // column of the ImageField type with the name imageFieldName
  ImageFieldValue currentFieldValue =
        listItemWithImageField[imageFieldName] as ImageFieldValue;

The problem is this only works for images that are in a list, like the PublishingRollupImage of a page that links to an image in the Site Collection Images library.  The actual images in the library are stored as documents (Referenced using SPFile) so in order utilize them I need to extract the information out and create an image tag for it...like so:

 
     ImageFieldValue imageValue = new ImageFieldValue(
          string.Format("<img src=\"{0}\" alt=\"{1}\" />",
          file.Url, file.Title == null ? string.Empty : file.Title));
 

Now that I had the ImageFieldValue it was easy to work with. I could manipulate many aspects of the image using this object and then save it for rendering using ToString(). Funny thing is for my purposes (ImageGallery xml generation) I didn't even end up needing this code after all...frustrating but a good learning experience.

Props to Phanat Chan as he did the initial development on this.

Technorati Tags: , ,

So I got this error the other day when putting together a dev site collection usign varations:

An error was encountered performing this operation. You may re-try the operation, and you may need to clean up the half-created data first before re-trying. If the problem persists, please contact your system administrator

This was actually a fairly easy fix for me.  I simply had to enable the publishing features in my site.  Which is funny...because they should have been on but I must have overlooked that.  :)

Technorati Tags: , , , ,

Day three was a lot of fun as I got to spend three hours in the labs and ran through some pretty cool stuff.  Linq to Sharepoint, Upgrading sites, REST API etc.

As far as the sessions went I was hoping the MultiLingual sites session was going to make me happy with some great news about variations.  Instead it seems to be status quo on that system with MS playing the line that you need to plan ahead for this...makes sense but not always possible.  The multi language user interface or MUI for all the chrome is available in every site now and you can switch languages off the site actions bar.

MindSharp had an awesome evangelistical session in the big room on Developiong with REST and LINQ in Sharepoint 2010.  This was another really great session on developing against the new Client Object Model, the Server OM, the ListData.svc REST service.

All in all it was another good day...If I didn't have to spend thenight doing homework it actually would haev been mouch more fun :|

Technorati Tags: , ,

The second day of the conference was great and a couple of sessions really stood out above the others in my mind....there was a great session in the morning on web part development and some of the new things coming up in that.  AJAX is baked into SP now which is great but there is also a bit of a learning curve surrounding XSS and making sure we understand cross-site scripting and how SharePoint really cracks down on this.

There was an amazing session on SharePoints new COM or client object model that exposes all sharepoint objects to the client (.NET CLR, silverlight and javascript).  Essentially we will be able to a LOT more work on the client side which makes me feel warm inside.

I finally got to play around with SharePoint 2010 in the labs which was great.  I was dying to get a feel for the product because it feels weird listening to all these sessions without actually having your hands on it.  I definitely will be spending more time in the labs.

The Huey Lewis and the News Beach Party was a lot of fun but I left there feeling a little...drunk for lack of a better word.  Good times in vegas...

Technorati Tags: , ,

Yesterday started with a hangover...for me.  On Sunday there was a SharePint event at the Eye Candy bar in the middle of Mandalay Bay and I was one of the  unfortunate souls whohappened to have drank too much :|   The Keynotes were pretty cool...nothing overly stand out there was a lot of talk about the new product and moving forward and a couple of demos that probably were a little too long.  Truth be told my butt hurt from sitting through almost 3 hours of Keynotes so I was happy when it was done.

In the afternoon the actual session began.  for me it was the Whats New For Developer Overview, Visual Studio 2010 Tools Overview and Web Content Management in SharePoint 2010.  We covered a lot of ground in the first two and and they were very much an overview of all the features available.  Things like running SP on the desktop client (x64 win7 or vista), visual studio 2010 build, debug, deploy, the developer dashboard, Linq to SharePoint (YES), the ribbon and sandboxed solutions.

The final session (the web content management one) was a bit of a disappointment.  It was a level 300 session and seemed like they dumbed it down for beginners, i mean they were teaching us how to make web pages via the UI.   There was some interesting stuff in the presentation but at no point did they really dive in and demo things like the variation model improvements or content deployment fixes they have made.  It was just alluded to.

Either way it was a pretty good day...met some great people from all over the world so far and I hope that continues.

Technorati Tags: , ,