SharePoint ows prefix? Internal Name?

ows = Open Geospatial Consortium Web Service

Read more about XML Prefixes

So, this ows is NOT part of SharePoint internal field name.

Short post, just feel a bit irritated when someone try to mislead me. On top of that, found a good reference list for SharePoint internal field names.

Byte Order Mark (BOM) 

I want to store xml in a SQL column type TEXT. I able to output the file properly as .xml file. But when I insert into database, I notice there is ‘special’ characters in front my xml.

After quick searching, found out it is actually a representation of Byte Order Mark(BOM) by encoding utf-8. More details in the Wiki

So, let’s jump into workaround to avoid the BOM  appearing.

Dim stream As New System.IO.MemoryStream
Dim uft8 As New System.Text.UTF8Encoding(False)
Dim xmlWriter As New XmlTextWriter(stream, uft8)

In the UTF8Encoding Constructor, just set the encoderShouldEmitUTF8Identifier boolean to false. Done.

Excel has detected that .csv is a SYLK file, but cannot load it

Ever get this error when opening a .csv file?

“Excel has detected that ‘xxx.csv’ is a SYLK file, but cannot load it. Either the file has errors or it is not a SYLK file format. Click OK to try to open the file in a different format.”

This happens when the first 2 characters in the file are “ID” (Capital). This will actually cost Excel use that as an indicator that the file is SYLK (SYmbolic LinK). So, the solution is actually just as simple as renaming the first 2 characters other than “ID”.  Lower case “id” will works too.

Empty Object ToString

I bet most people aware that direct convert an empty object using ToString() will throw exception. A typical way to overcome this is to check if the object is empty, return an emptry string instead. Easily done on C#, today was trying to achive the same with vb.

Private Function ToSafeString(ByVal obj As Object) As String
        If obj Is Nothing Then
            Return String.Empty
            Return obj.ToString()
        End If
    End Function

Being so use with C# “null”, found out in vb is “Nothing”.