Monday, 15 December 2008

The formula contains a syntax error or is not supported

[TR]
Calculated field'larla uğraşırken IF statement'ında şöyle bir hata aldım.

The formula contains a syntax error or is not supported. at Microsoft.SharePoint.Library.SPRequestInternalClass.UpdateField(String bstrUrl, String bstrListName, String bstrXML) at Microsoft.SharePoint.Library.SPRequest.UpdateField(String bstrUrl, String bstrListName, String bstrXML)

Ufak bir araştırma sonunda bunun Default Language pack ile ilgili olduğunu buldum. Default'ta virgül kullanılırken diğerlerinde noktalı virgül kullanmak gerekiyormuş

Default Language Pack:
=IF([Currency]>10,"TRUE","FALSE")

Diğer Language Pack:
=IF([Currency]>10;"TRUE";"FALSE")


[ENG]
I get an error while working with calculated fields. The error message was;

The formula contains a syntax error or is not supported. at Microsoft.SharePoint.Library.SPRequestInternalClass.UpdateField(String bstrUrl, String bstrListName, String bstrXML) at Microsoft.SharePoint.Library.SPRequest.UpdateField(String bstrUrl, String bstrListName, String bstrXML)

Formula was working at my development site but giving error at production site.
I realised that if you are using an IF statement with default language pack it works fine. Otherwise you should use semicolon instead of comma

Default Language Pack:
=IF([Currency]>10,"TRUE","FALSE")

Other Language Packs:
=IF([Currency]>10;"TRUE";"FALSE")

Thursday, 4 December 2008

Calculated Field Formulas

[TR]
Herzaman google'da arıyordum. barı blog'a kaydedeyim de bulmam kolay olsun dedim :)
[ENG]
I was googling the link everytime I needed. Then I thought it would be better to write it on the blog :)
http://msdn.microsoft.com/en-us/library/bb862071.aspx

Thursday, 11 September 2008

SPLookupField Helper function

[TR]
Sharepointte bir listeye kod veri girişi yapacaksanız ve bu listenin bir kolonu Lookup field olarak tanımlandıysa bu kolunu nasıl doldurmanız gerektiği ile ilgili güzel bir class yazılmış. Benim çok işime yaradı :)

[ENG]
If you need to fill some values to a list by code and one of the colums of the list is defined as connected lookup you should better check this helper class. It helped me a lot :)http://blogs.sharepointguys.com/matt/sharepoint-2007-development/splookupfield-helper-function/

Saturday, 30 August 2008

Microsoft announces a new software...

[TR]
Microsoft bilgisayarınızda enerji tasarrufu sağlayabileceğiniz ücretsiz bir program çıkardı. Ben indirdim kullanmaya başladım. Nekadar faydası olur ileriki günlerde görecez.
[ENG]
Microsoft announced a new free software for power saving. I downloaded and started to use. We will see how effective the program is in a couple of days.

Sunday, 17 August 2008

Adding Property to SPNavigationNode

[TR]
Birkaç gün önce yöneticim Sharepoint için 4. kırılıma kadar destekleyen ve node'larında extra değerler tutabileceğim bir menu manager yazmamı istedi. Bunu sharepoint standardında yapmam gerekiyordu. İlk önce SPNavigationNode sınıfını extend etmeyi düşündüm ancak bunun sealed bir class olduğunu farkettim. Daha sonra extra değerleri property olarak tutmaya karar verdim. Ancak bir sorun vardı. Bir türlü property ekleyemiyordum.
En sonunda node'a property ekleyebilmek için önce node'u oluşturup, siteye kaydedip, daha sonra geri çağırıp, property'i ekleyip, node'u update etmem gerektiğini öğrendim. Örnek kodu aşağıda veriyorum

[ENG]
My manager asked me to write a component to sharepoint which makes it possible to add 3th & 4th level link node to sharepoint navigation. It was like adding a new heading under a heading and then adding link to the second heading. That was easy. But the main problem was I needed to add some new properties to that link (like "is default page" value). I tried to extend SPNavigationNode class but I realised that it is a sealed class and sharepoint keeps each property as a different column in DB. Then I realed that adding my new values as a property vould solve my problem. But the problem was when I added a property I got compile time error.
Finally I learned that to add a property to a SPNavigationNode we must first create the object, add it to navigation, call the node back, add properties, update node.
Here is a sample code;

SPNavigationNodeCollection nodes = PublishingWeb.GetPublishingWeb(spweb);
SPNavigationNode newNode = new SPNavigationNode("DeveloperKoala",
"http://developerkoala.blogspot.com");
nodes.AddAsLast(newNode);
node = nodes[nodes.Count() -1];
node.Properties.Add("ExtendedProperty", "This is a cool site");
node.Update();

Friday, 4 July 2008

Creating view which shows approved/rejected items at workflow

[TR]
Sharepoint'te bir listeye workflow bağlayıp herbir item için onay almanız mümkün. Bunu yaptıktan sonra bir view tanımlayıp sadece kabul edilen önerileri görmek isterseniz muhtemelen ilk yapacağınız şey bir view tanımlayıp Workflow Status kolonu is equal to Approved yapmak olacaktır. Ancak view'a dönüp baktığınızda hiçbir item'ın gelmediğini göreceksiniz. Hatta is equal yerine is not equal yazarsanız bu defa da query error ile karşılaşacaksınız. Bunun nedeni Sharepoint'in Accept, reject gibi değerleri enum olarak tutmasıdır. Buna göre kabul edilen öneriler için Status is equal to 16 demeniz gerekiyor. Diğer durumları ve kodlarını aşağıda bulabilirsiniz.

Durum Değer
Not Started 0
Failed on Start 1
In Progress 2
Error Occurred 3
Canceled 4
Completed 5
Failed on Start (retrying) 6
Error Occurred (retrying) 7
Canceled 15
Approved 16
Rejected 17

[ENG]
Sharepoint allows you can to connect an approval workflow to a list. If you want to see the items that has been approved the first thing you will probably do will be creating a new view and settind Workflow Status column is equal to Approved. But when you look at the list you will see that there is not any item at that view. If you modify this view and change is equal condition as is not equal you will get a query error at view's display page. Reason for that is sharepoint keeps that conditions as enum. for example if you want to display only approved itemsi you must set Workflow status is equal to 16. Here are other workflow status and codes

Status Code
Not Started 0
Failed on Start 1
In Progress 2
Error Occurred 3
Canceled 4
Completed 5
Failed on Start (retrying) 6
Error Occurred (retrying) 7
Canceled 15
Approved 16
Rejected 17