zondag 4 augustus 2013

Disable Save button on an Edit Form and the Ribbon Save Button


If you want to play with the Save button of Sharepoint, and also the save buttons in the ribbon,
you can use the next script in a Content Editor webpart. 
I have written my own custom Function for this nice functionality that I use all the time since I wrote it.
It let me help to prevent the Save action for users when your Item has a certain status. 
But not with playing with the security! 

I use a Status field that has the type Choise Field. 
Here I put the different steps that my form can have. For example a step for Acceptation,
or a step for Refusing, Canceling, etc. 
When for example a form has the step Refused, nobody my edit the item anymore. 
You can do this by playing with 
security settings in a workflow, but you risk that the workflow isn't executed directly. 
At that moment somebody can still change the item!
And Item Level Security on big lists aren't supported! 

With this method, you prevent that nobody save changes in your custom Edit form 
when the Item field Status has a certain value. 
And you can specify some administators, or a second EditForm where you can allow to edit 
the Item for an intervention. 

If you have remarks, please let me know... 
  

$(document).ready( function() {
            checkStatusForSave();
});

  

function checkStatusForSave()

{
// I use a custom Status Choise field for workflow actions. 
   var fieldStatusRef = $(':select[title="Status"]');
   var StatusRef = $(':select[title="Status"]').val();
   switch (StatusRef)
        {
            case 'Waiting for action A':
// the Item may be saved.
                        disableSave(false);
            break;
            case 'Refused':
// you may not save any changes to the Item.
                        disableSave(true);

            break;
            default:
        }
}

function disableSave(bAlways)
{

 if($(':span[title="Open Menu"]').text().indexOf('FILL IN YOUR NAME SO YOU CAN SAVE ITEMS') == -1)
 { // not an administrator
      if (bAlways)
      {
          $(':input[value="Save"]').attr("disabled",true);
          $("span.ms-cui-ctl-largelabel:contains('Save')").parent("a").hide();
      }
      else
      {
          if ($(':span[title="Open Menu"]').text().indexOf($(':input[title="Title"]').val()) != -1)
          {
              $(':input[value="Save"]').attr("disabled",true);
              $("span.ms-cui-ctl-largelabel:contains('Save')").parent("a").hide();
          }
          else
          {
              $(':input[value="Save"]').attr("disabled",false);
              $("span.ms-cui-ctl-largelabel:contains('Save')").parent("a").show();
          }
      }
 }
}
 

Sharepoint Images and Icons of the Sharepoint Layouts folder


Found a nice blog where you can find a list of all the sharepoint images 
that are used in sharepoint.
So if you want to create your own links, you can use these images in your pages.  


SharePointLayoutImages

Thanks to Peter for this wonderfull site. 
  

donderdag 17 januari 2013

Replace Point keystroke with a Comma


Sometimes you need to prevent your user to use some key characters in your Input Fields.
Like my customer wanted also to use the Comma [,] as the Point [.] as decimal seperator. 
If you use for example Dutch regional settings the decimal seperator is the [,] and the Point is used
as thousant seperator. So my customer wanted to use as Point as Comma as seperator. 
What to do about it? 
Simple answer. Catch the keystroke of the Point and replace it by a Comma. 
My solution below is not perfect if they put a Point between the numbers. 
If someone knows what I have to add in place of the fill up of the ","
please don't hesitate to let me know.
 

$(document).ready(function() {
 if ($(":input[title='MyField']").val() != "")
  $("nobr:contains('MyField')").closest('tr').hide();
 ReplacePointbyComma();
});

function ReplacePointbyComma(){
    $(":input[title='MyNumericField']").keydown(function(e) {
  var keycode = (e.keyCode ? e.keyCode : e.which);
  /// 110 Point on numeric keyblock
  /// 190 Shift Point in alfanumeric keyblock
  if (keycode == 110 || keycode == 190 )
  {
   e.preventDefault();
   $(":input[title='MyNumericField']").val($(":input[title='MyNumericField']").val() + ",");
  }
 });
}
 

maandag 7 januari 2013

List of available Sharepoint Services

List of available Sharepoint Services
SharePoint Object Model is a .Net based Application Programming Interface to interact with SharePoint components. But all the applications written using SharePoint Object Model require to be run on the SharePoint Server itself. It is not possible to use it to work remotely with a SharePoint Server.

SharePoint Web Services provides the capability to work with SharePoint server remotely. But SharePoint Web Services are not as much as rich as SharePoint Object Model and all SharePoint features and components are not accessible through Web Services. But it includes Web Services to interact with most commonly used SharePoint features and components. If out-of-the-box SharePoint Web Services doesn’t fit on our requirements, we can also build custom web service on top of SharePoint leveraging the SharePoint Object Model API.
I had prepared a concise list of SharePoint Web Services for my own reference which I am sharing with you:  

1) Administration Web Service (http://<site>/_vti_bin/Admin.asmx): The Administration Web service provides methods that can beused to manage Windows SharePoint Services such as creating or deleting site collections. 
Following are the main methods provided by this service:
  • CreateSite
  • DeleteSite
  • GetLanguages
  • RefreshConfigCache
2) Alerts Web Service (http://<Site>/_vti_bin/Alerts.asmx):
The alerts web service provides methods for working with alert subscriptions
for the listitems in a SharePoint site remotely. Alert subscriptions specify when and how notifications are sent to users when changes are made to content stored on the server. Following are the two main methods provided by this service:
  • GetAlerts
  • DeleteAlerts
3) Copy Web Service (http://<Site>/_vti_bin/Copy.asmx):

This web service provides capability to move files from one list to another within a SharePoint site or between different SharePoint sites. Following are the main methods provided by this service:

  • GetItem
  • CopyIntoItems
  • CopyIntoItemsLocal
4) Document Workspace Web Service (http://<Site>/_vti_bin/Dws.asmx):

This web service provides methods for managing Document Workspace sites and the data they contain. Following are the main methods provided by this service:

a) Managing Document Workspace sites

  • CanCreateDwsUrl
  • CreateDws
  • RenameDws
  • DeleteDws
b) Managing data for the Document Workspace site

  • GetDwsData
  • GetDwsMetaData
  • UpdateDwsData
c) Managing folders in the Document Workspace site

  • CreateFolder
  • DeleteFolder
d) Managing documents in the Document Workspace site

  • FindDwsDoc
e) Managing site users for the Document Workspace site

  • RemoveDwsUser

5) Forms Web Service (http://<Site>/_vti_bin/Forms.asmx):

The Forms service provides methods for returning forms that are used in the user interface when working with the contents of a list. There are following two methods available:

  • GetForm 
  • GetFormCollection
6) Imaging Web Service (http://<Site>/_vti_bin/Imaging.asmx):

The Imaging service provides methods that enable you to create and manage picture libraries. There are following methods that can be utilized with the imaging web service:

  • CheckSubwebAndList
  • CreateNewFolder
  • Delete
  • Download
  • Edit
  • GetItemsByIds
  • GetItemsXMLData
  • GetListItems
  • ListPictureLibrary
  • Rename
  • Upload 

7) Lists Web Service (http://<site>/_vti_bin/Lists.asmx):

The Lists Web service provides methods for working with SharePoint lists, content types, list items, and files. There are following methods that can be utilized with the Lists web service:

  • AddAttachment
  • AddDiscussionBoardItem
  • AddList
  • AddListFromFeature
  • ApplyContentTypeToList
  • CheckInFile
  • CheckOutFile
  • CreateContentType
  • DeleteAttachment
  • DeleteContentType
  • DeleteContentTypeXmlDocument
  • DeleteList
  • GetAttachmentCollection
  • GetList
  • GetListAndView
  • GetListCollection
  • GetListContentType
  • GetListContentTypes
  • GetListItemChanges
  • GetListItemChangesSinceToken
  • GetListItems
  • GetVersionCollection
  • UndoCheckOut
  • UpdateContentType
  • UpdateContentTypeXmlDocument
  • UpdateList
  • UpdateListItems

8) Meetings Web Service (http://<Site>/_vti_bin/Meetings.asmx):

This web service enables you to create and manage Meeting Workspace sites. Following are the main methods available in the web service:

  • AddMeeting
  • AddMeetingFromICal
  • CreateWorkspace
  • DeleteWorkspace
  • GetMeetingWorkspaces
  • GetMeetingsInformation
  • RemoveMeeting
  • RestoreMeeting
  • SetAttendeeResponse
  • SetWorkspaceTitle
  • UpdateMeeting
  • UpdateMeetingFromICal

9) People Web Service (http://<Site>/_vti_bin/People.asmx):

This service provides methods that can be used to associate user identifiers (IDs) with security groups for SharePoint Web site permissions. It contains following methods:

  • GetPrincipalsInGroup
  • ResolvePrincipals
  • SearchPrincipals

10) Permissions Web Service (http://<site>/_vti_bin/Permissions.asmx):

Permissions Web service provides methods for working with SharePoint list and site permissions. Following are the various methods available in this service:

  • AddPermission
  • AddPermissionCollection
  • GetListItemPermissionsByUser
  • GetListPermissionsByUser
  • GetPermissionCollection
  • GetPermissionsByToken
  • GetPermissionsByUser
  • RemovePermission
  • RemovePermissionCollection
  • UpdatePermission

11) SharePoint Directory Management Service (http://<Site>/_vti_bin/sharepointemailws.asmx):

This service provides methods for managing Active Directory e-mail distribution groups and their membership. It provides following main methods:

  • CreateContact
  • DeleteContact
  • ModifyContact
  • CreateDistributionGroup
  • DeleteDistributionGroup
  • ModifyDistributionGroup
  • RenameDistributionGroup
  • ChangeContactsMembershipInDistributionGroup
  • ChangeUsersMembershipInDistributionGroup 

12) Site Data Web Service (http://<Site>/_vti_bin/SiteData.asmx):

The Site Data service provides methods that return metadata or list data from sites or lists in Microsoft Windows SharePoint Services. This web service is read only. Following are the main methods provided by this service:

  • GetList
  • GetListCollection
  • GetListItems 
  • EnumerateFolder
  • GetAttachments
  • GetChanges
  • GetContent
  • GetSite
  • GetWeb 
  • GetSiteAndWeb
  • GetSiteUrl
  • GetURLSegments 

13) Sites Web Service (http://<Site>/_vti_bin/Sites.asmx):

The Sites service provides a method for returning information about the collection of site templates on the virtual server. Following are the main methods provided by this service:

  • ExportWeb
  • ImportWeb
  • GetSiteTemplates
  • GetUpdatedFormDigest

14) Search Web Service (http://<site>/_vti_bin/search.asmx):

The QueryService can be used to query the search indexes in the same way that you would search from the home page of a SharePoint site. Main methods available in this service are as below:

  • Query
  • QueryEx
  • GetPortalSearchInfo
  • GetSearchMetadata
  • Registration
  • Status 

15) Users and Groups Web Service (http://<Site>/_vti_bin/usergroup.asmx):

The Users and Groups Web service provides methods for working with users, role definitions, and groups. It provides huge number of methods which are listed below:

  • AddGroup
  • AddGroupToRole
  • AddRole
  • AddRoleDef
  • AddUserCollectionToGroup
  • AddUserCollectionToRole
  • AddUserToGroup
  • AddUserToRole
  • GenerateXmlMappings 
  • GetAllUserCollectionFromWeb
  • GetGroupCollection
  • GetGroupCollectionFromRole
  • GetGroupCollectionFromSite
  • GetGroupCollectionFromUser
  • GetGroupCollectionFromWeb
  • GetGroupInfo
  • GetHashCode 
  • GetLifetimeService 
  • GetRoleCollection
  • GetRoleCollectionFromGroup
  • GetRoleCollectionFromUser
  • GetRoleCollectionFromWeb
  • GetRoleInfo
  • GetRolesAndPermissionsForCurrentUser
  • GetRolesAndPermissionsForSite
  • GetUserCollection
  • GetUserCollectionFromGroup
  • GetUserCollectionFromRole
  • GetUserCollectionFromSite
  • GetUserCollectionFromWeb
  • GetUserInfo
  • GetUserLoginFromEmail
  • RemoveGroup
  • RemoveGroupFromRole
  • RemoveRole
  • RemoveUserCollectionFromGroup
  • RemoveUserCollectionFromRole
  • RemoveUserCollectionFromSite
  • RemoveUserFromGroup
  • RemoveUserFromRole
  • RemoveUserFromSite
  • RemoveUserFromWeb
  • UpdateGroupInfo
  • UpdateRoleDefInfo
  • UpdateRoleInfo
  • UpdateUserInfo 

16) Versions Web Service (http://<site>/_vti_bin/Versions.asmx):

Versions Web service provides methods for working with file versions in SharePoint document libraries. Methods included in this service:

  • DeleteAllVersions 
  • DeleteVersion 
  • GetVersions 
  • RestoreVersion 

17) Views Web Service (http://<site>/_vti_bin/Views.asmx):

Views Web service provides methods for creating, deleting, or updating list views. Methods included in this service are as below:

  • AddView
  • DeleteView
  • GetView 
  • GetViewCollection 
  • GetViewHtml 
  • UpdateView 
  • UpdateViewHtml

18) Web Part Pages Web Service (http://<Site>/_vti_bin/WebPartPages.asmx):

Web Part Pages service provides methods for working with Web Parts. Following are the various methods provided by this service:

  • AddWebPart
  • AddWebPartToZone
  • AssociateWorkflowMarkup
  • ConvertWebPartFormat
  • DeleteWebPart
  • ExecuteProxyUpdates
  • FetchLegalWorkflowActions
  • GetCustomControlList
  • GetDataFromDataSourceControl
  • GetFormCapabilityFromDataSourceControl
  • GetWebPart
  • GetWebPart2
  • GetWebPartCrossPageCompatibility
  • GetWebPartPage
  • GetWebPartPageConnectionInfo
  • GetWebPartPageDocument
  • GetWebPartProperties
  • GetWebPartProperties2
  • GetXmlDataFromDataSource
  • RemoveWorkflowAssociation
  • RenderWebPartForEdit
  • SaveWebPart
  • SaveWebPart2
  • ValidateWorkflowMarkupAndCreateSupportObjects 

19) Webs Web Service (http://<Site>/_vti_bin/Webs.asmx):

Webs service provides methods for working with sites and subsites. Following are the various methods provided by this service:

  • CreateContentType
  • CustomizeCss
  • DeleteContentType
  • GetActivatedFeatures
  • GetAllSubWebCollection
  • GetColumns
  • GetContentType
  • GetContentTypes
  • GetCustomizedPageStatus
  • GetListTemplates
  • GetWeb
  • GetWebCollection
  • RemoveContentTypeXmlDocument
  • RevertAllFileContentStreams
  • RevertCss
  • RevertFileContentStream
  • UpdateColumns
  • UpdateContentType
  • UpdateContentTypeXmlDocument
  • WebUrlFromPageUrl 

To get the full details of above SharePoint Web Services and their respective Methods please visit SharePoint Web Services MSDN Page @ http://msdn.microsoft.com/en-us/library/ms479390.aspx.

 

 



Visit the Sharepoint Community site for all Sharepoint related info.

Belfius Bank

dinsdag 27 november 2012

How to give a Date field the correct format in a custom DispForm


I have one new trick to tell you today...

Imagine you have a Sharepoint list with a Date field that is only showing a date value and not the Time. If you create a Custom Display Form in Sharepoint Designer, you will see something incredible.

    - Date field shows Time value
    - Date field shows less 1 hour, which might lead to show one less day in date value

Just like this:


Check how I got the Date format...


1. Open your custom form in Sharepoint Designer and select the date value.


2. Click the Formule button and write the following Formule:

ddwrt:FormatDate(string(@Date), 1033, 1)

    Don't forget to use the string function!! Otherwise it will give you an error in XPath
    1033 is the locale code, check other locale codes here List of Locale Codes
    1 is the date format, the possible values are 1, 4, 5, 7,12, 13 or 15, each represent a different date format, pick the one that suites you better.

At least save your form and you will see a splendid result.

Enjoy my little trick... 

LCID Dec values for the XSLT FormatDate function

Use the LCID Dec values for the FormatDate function.
ddwrt:FormatDate(string(@Date), 1033, 1)
Language - Country/RegionLCID HexLCID Dec
Afrikaans - South Africa04361078
Albanian - Albania041c1052
Alsatian04841156
Amharic - Ethiopia045e1118
Arabic - Saudi Arabia04011025
Arabic - Algeria14015121
Arabic - Bahrain3c0115361
Arabic - Egypt0c013073
Arabic - Iraq08012049
Arabic - Jordan2c0111265
Arabic - Kuwait340113313
Arabic - Lebanon300112289
Arabic - Libya10014097
Arabic - Morocco18016145
Arabic - Oman20018193
Arabic - Qatar400116385
Arabic - Syria280110241
Arabic - Tunisia1c017169
Arabic - U.A.E.380114337
Arabic - Yemen24019217
Armenian - Armenia042b1067
Assamese044d1101
Azeri (Cyrillic)082c2092
Azeri (Latin)042c1068
Bashkir046d1133
Basque042d1069
Belarusian04231059
Bengali (India)04451093
Bengali (Bangladesh)08452117
Bosnian (Bosnia/Herzegovina)141A5146
Breton047e1150
Bulgarian04021026
Burmese04551109
Catalan04031027
Cherokee - United States045c1116
Chinese - People's Republic of China08042052
Chinese - Singapore10044100
Chinese - Taiwan04041028
Chinese - Hong Kong SAR0c043076
Chinese - Macao SAR14045124
Corsican04831155
Croatian041a1050
Croatian (Bosnia/Herzegovina)101a4122
Czech04051029
Danish04061030
Dari048c1164
Divehi04651125
Dutch - Netherlands04131043
Dutch - Belgium08132067
Edo04661126
English - United States04091033
English - United Kingdom08092057
English - Australia0c093081
English - Belize280910249
English - Canada10094105
English - Caribbean24099225
English - Hong Kong SAR3c0915369
English - India400916393
English - Indonesia380914345
English - Ireland18096153
English - Jamaica20098201
English - Malaysia440917417
English - New Zealand14095129
English - Philippines340913321
English - Singapore480918441
English - South Africa1c097177
English - Trinidad2c0911273
English - Zimbabwe300912297
Estonian04251061
Faroese04381080
Farsi04291065
Filipino04641124
Finnish040b1035
French - France040c1036
French - Belgium080c2060
French - Cameroon2c0c11276
French - Canada0c0c3084
French - Democratic Rep. of Congo240c9228
French - Cote d'Ivoire300c12300
French - Haiti3c0c15372
French - Luxembourg140c5132
French - Mali340c13324
French - Monaco180c6156
French - Morocco380c14348
French - North Africae40c58380
French - Reunion200c8204
French - Senegal280c10252
French - Switzerland100c4108
French - West Indies1c0c7180
Frisian - Netherlands04621122
Fulfulde - Nigeria04671127
FYRO Macedonian042f1071
Galician04561110
Georgian04371079
German - Germany04071031
German - Austria0c073079
German - Liechtenstein14075127
German - Luxembourg10074103
German - Switzerland08072055
Greek04081032
Greenlandic046f1135
Guarani - Paraguay04741140
Gujarati04471095
Hausa - Nigeria04681128
Hawaiian - United States04751141
Hebrew040d1037
Hindi04391081
Hungarian040e1038
Ibibio - Nigeria04691129
Icelandic040f1039
Igbo - Nigeria04701136
Indonesian04211057
Inuktitut045d1117
Irish083c2108
Italian - Italy04101040
Italian - Switzerland08102064
Japanese04111041
K'iche04861158
Kannada044b1099
Kanuri - Nigeria04711137
Kashmiri08602144
Kashmiri (Arabic)04601120
Kazakh043f1087
Khmer04531107
Kinyarwanda04871159
Konkani04571111
Korean04121042
Kyrgyz (Cyrillic)04401088
Lao04541108
Latin04761142
Latvian04261062
Lithuanian04271063
Luxembourgish046e1134
Malay - Malaysia043e1086
Malay - Brunei Darussalam083e2110
Malayalam044c1100
Maltese043a1082
Manipuri04581112
Maori - New Zealand04811153
Mapudungun04711146
Marathi044e1102
Mohawk047c1148
Mongolian (Cyrillic)04501104
Mongolian (Mongolian)08502128
Nepali04611121
Nepali - India08612145
Norwegian (Bokmål)04141044
Norwegian (Nynorsk)08142068
Occitan04821154
Oriya04481096
Oromo04721138
Papiamentu04791145
Pashto04631123
Polish04151045
Portuguese - Brazil04161046
Portuguese - Portugal08162070
Punjabi04461094
Punjabi (Pakistan)08462118
Quecha - Bolivia046B1131
Quecha - Ecuador086B2155
Quecha - Peru0C6B3179
Rhaeto-Romanic04171047
Romanian04181048
Romanian - Moldava08182072
Russian04191049
Russian - Moldava08192073
Sami (Lappish)043b1083
Sanskrit044f1103
Scottish Gaelic043c1084
Sepedi046c1132
Serbian (Cyrillic)0c1a3098
Serbian (Latin)081a2074
Sindhi - India04591113
Sindhi - Pakistan08592137
Sinhalese - Sri Lanka045b1115
Slovak041b1051
Slovenian04241060
Somali04771143
Sorbian042e1070
Spanish - Spain (Modern Sort)0c0a3082
Spanish - Spain (Traditional Sort)040a1034
Spanish - Argentina2c0a11274
Spanish - Bolivia400a16394
Spanish - Chile340a13322
Spanish - Colombia240a9226
Spanish - Costa Rica140a5130
Spanish - Dominican Republic1c0a7178
Spanish - Ecuador300a12298
Spanish - El Salvador440a17418
Spanish - Guatemala100a4106
Spanish - Honduras480a18442
Spanish - Latin America580a22538
Spanish - Mexico080a2058
Spanish - Nicaragua4c0a19466
Spanish - Panama180a6154
Spanish - Paraguay3c0a15370
Spanish - Peru280a10250
Spanish - Puerto Rico500a20490
Spanish - United States540a21514
Spanish - Uruguay380a14346
Spanish - Venezuela200a8202
Sutu04301072
Swahili04411089
Swedish041d1053
Swedish - Finland081d2077
Syriac045a1114
Tajik04281064
Tamazight (Arabic)045f1119
Tamazight (Latin)085f2143
Tamil04491097
Tatar04441092
Telugu044a1098
Thai041e1054
Tibetan - Bhutan08512129
Tibetan - People's Republic of China04511105
Tigrigna - Eritrea08732163
Tigrigna - Ethiopia04731139
Tsonga04311073
Tswana04321074
Turkish041f1055
Turkmen04421090
Uighur - China04801152
Ukrainian04221058
Urdu04201056
Urdu - India08202080
Uzbek (Cyrillic)08432115
Uzbek (Latin)04431091
Venda04331075
Vietnamese042a1066
Welsh04521106
Wolof04881160
Xhosa04341076
Yakut04851157
Yi04781144
Yiddish043d1085
Yoruba046a1130
Zulu04351077
HID (Human Interface Device)04ff1279
List copied from http://msdn.microsoft.com/en-us/goglobal/bb964664

dinsdag 6 november 2012

Horizontal alignment of Choise Fields


This week I found a way to change the alignment of a Choice Field.
Nice to know if you have list of questions where somebody has to choose
between for example three answers. 

You only have to make a custom New/Edit page in Sharepoint Designer
and add the next line
<xsl:comment>FieldName="Display Name"</xsl:comment>                                                          
just before the sharepoint Formfield definition <SharePoint:FormField …

Change the "Display Name" by the display name of your Sharepoint Field.

Add a Content Editor webpart to your page and 
put the next Jquery script in this webpart.


<script>
$( document ).ready( function() {
// columnName = Field Display Name
// perRow = how many choices you want to see in one row.
            $().SPServices.SPArrangeChoices({
                        columnName : "Display Name",
                        perRow: 3
                        });
});
</script>