Gorgo.Live.ToString()

Mariusz, Gorzoch tech Blog

Archive for December 2011

an error occurred while executing the command definition

leave a comment »

This message eat few hours of my day and I couldn’t figure out what this is about till I started SQL profiler and found that my entity framework model is generating improper SQL statements. In general my scenario was that I’ve build my app against SQL 2005 and then tried to deploy it on SQL 2000. Unfortunately entity framework is not enough smart to see this difference by himself so I’ve end up getting mentioned above error.

Lucky solution to it is quite simple. I found it on this stack overflow post  : http://stackoverflow.com/questions/1413881/sqlexception-0x80131904-line-28-incorrect-syntax-near 

what you need to do is :

open your model .edmx with xml editor, and modify this
 ProviderManifestToken="2008"
to
 ProviderManifestToken="2000"

once I’ve did this magic happened and my apps started to fly

Happy 2012 year !

Advertisements

Written by Mariusz Gorzoch

31 December 2011 at 20:49

Posted in Bez kategorii

Tagged with ,

Site usage reports not showing data

leave a comment »

For last few coupe of days I was trying to setup site usage reporting on our SharePoint 2007 standard (with for some reason stopped to report any statistics). On the end I manage to make them work again and here is a list of things I needed to check/correct in order to show them again:

1. Enable usage logging for the farm

Please refer to http://technet.microsoft.com/en-us/library/cc262541%28office.12%29.aspx 

image

2. Enable usage reporting

Please refer to http://technet.microsoft.com/en-us/library/cc262541%28office.12%29.aspx

image

3. Activate the reporting feature per each site collection

Please refer to http://technet.microsoft.com/en-us/library/cc262541%28office.12%29.aspx 

image

4. (Optional) Enable nice usage reports per web

If you do not do this step then your reports will look more or less like this:

image

but if you want to have more nice reports then you need to active “site feature” called “Office SharePoint Server Standard Site features” (for some reason in my case this feature is not activated by default)

image

if you do this then your reports will start looks like this (of course you will get that once usage processing complete with success)

image

5. Make sure that groups WSS_ADMIN_WPG and WSS_WPG have “full control” rights to the folder where you decided to store your “Usage statistics” (you make that decision in point 1)

For some reason when you set-up this special folder in point 1 then SharePoint do not grant those permission with is causing that “usage information” are not processed. Make sure that you double check that as this is quite important

6. Refresh configuration cache

SharePoint configuration cache can from time to time messed up. In my case, cleaning this cache was also part of the process to bring my statistics back online. In order to clean cache please refer to this blog post (Clear the SharePoint Configuration Cache) http://blogs.msdn.com/b/josrod/archive/2007/12/12/clear-the-sharepoint-configuration-cache-for-timer-job-and-psconfig-errors.aspx 

 

Once I’ve performed above steps, then on the next day magic happened and I get my statistics back.

Written by Mariusz Gorzoch

22 December 2011 at 08:57

InfoPath and adding new field to source

leave a comment »

Let’s say you created an InfoPath template based on some well defined XML document. You deployed your solution and it was working for a while without any issues. Now someone comes to you and ask to extend this template by adding one more field ! Unfortunately InfoPath do not support that :(. Of course you can add new field from the “Designer” but it would be added with InfoPath namespace with will not confirm to the source XML document (with let’s say is generated by external system). Happy there is a trick to overcome that.

Let’s start with explaining what we want to do. Bellow we have our current source :

image

what we want to do is to extend it by adding one more field under “ERPOrderItem” called “CompanyID”. Below our the steps with worked for me:

1. Go to File->Publish and use “Export Source Files” to save artifacts of your template in pointed folder. Once you do this you should get into your folder files like bellow:

image

(you can also get those files, by just changing extension of you YourInfoPathFile.xsn to YourInfoPathFile.cab and extracting all content from it)

2. Change “sampledata.xml” file by adding new element. In my case what I added you can see bellow:

image

3. Change “schema.xsd” file

image

4. Change “template.xml”

image

5. Done, now please open InfoPath Designer and open “manifest.xsf” file from the directory where you performed above changes. What you should get is:

image

Now save your form/publish it and enjoy 🙂

Written by Mariusz Gorzoch

21 December 2011 at 09:56

Posted in InfoPath 2010

Document library and SharePoint alerts

leave a comment »

Working with alerts and document library can be a little bit tricky and the reason of it is the “check-in” / “check-out” functionality. Do you know that if you make some requirements on the metadata (for example you will set-up one field as required) then SharePoint will stop sending all alerts of type “New items are added” ? Yes, that it is true and here are some explanation why this is happening :

When there is no requirements on metadata, then once you upload document, then SharePoint perform auto check-in on it and make it published. This is causing that on the server side in eventcache table new entire get created with event type = 4097 (item created) and ACL letting this information to be sent to subscribers (file is published and freely available to all users with read access).

Where we have some requirements on  metadata like for example one field is required then once you upload document, then he get created and stuck in draft mode. This event causes creation of some entry like in previous case but in that case ACL do not let system to send notification as this file is not yet publicly available. On the next screen of uploading document you put all necessary data and hit check-in document, but this is now next operation (=”Item change event”) and this is not treated as part of “Item created event”.

image

on the above picture you can see a case when there are some required field on the  document library. In that you can see that process of uploading file and checking it in cased even three events:

  1. 4097 = File uploaded (draft mode) <- “New item notification not working”
  2. 8194 = Metadata were updated  (required field was provided)
  3. 8194 = File was check-in <- “Item changed notification is sent”

So, as you can see making just one “required” field on metadata can make alert engine behave differently and stop him to sent notification.

Of course if you are really keen on doing this, then there is a way to overcome this by using “search alerts”. Those alerts are working based on the search crawler, so there is no risk that “new item” on the result will be  skipped as there will be always a point in time when crawler will see your files for the first time.

Written by Mariusz Gorzoch

8 December 2011 at 09:40

Posted in SharePoint 2007

Tagged with