|
|
|
jQuery with Sharepoint. Share jPoint - it's open source.
jPoint API
| API Reference |
Type |
Description |
| Lists |
Subclass |
Manipulates lists and list items (retrieve, save, delete) |
| List |
Subclass |
|
| Form |
Subclass |
Manipulates fields on a form (get/set, hide, disable) |
| Webparts |
Subclass |
Manipulates webparts on a page (overwrite script vars) |
| Core |
--- |
The base jPoint class has utility functions and helpful variables |
Show All |
Hide All
Lists
The main purpose of Lists is to interact with the
lists.asmx web service. It abstracts the web service and does a lot of the heavy
lifting for the jPoint API developer. The main function that will be used is
setSPObject() and from there, you can work with a specific List. The Lists class
can contain a collection of List Item objects so you can have
jP.Lists.Announcements and jP.Lists.Tasks.
| Name |
Type |
Description |
| List |
Subclass |
Manipulates SP List items (retrieve, save, delete) |
| setSPObject |
Function |
Creates a List Item |
| [list name] |
Variable |
List Collection array that has been created from setSPObject calls |
| Items |
Variable |
List Item Collection array created from last List operation |
| FieldCount |
Variable |
Length of Items array created from last List operation |
MethodjPoint.Lists.setSPObject( SiteURL, ListName )
Arguments
| Name |
Type |
Optional |
Description |
| SiteURL |
String |
false |
SiteURL |
| ListName |
String |
false |
Sharepoint List Name |
List
| Name |
Type |
Description |
| getSPItem |
Function |
Gets a unique SharePoint list item by ID (int) |
| getSPItemsWithQuery |
Function |
Gets a set of SharePoint list items by CAML Query |
| updateItem |
Function |
Updates or adds an item to a SharePoint list |
| addItem |
Function |
Add a new item to a SharePoint list |
| getSPView |
Function |
Populates a jPoint object with items for particular SharePoint view |
| getPictures |
Function |
Populates a jPoint object with items for particular SharePoint Picture List
view |
MethodList.getSPItem( ListItemID )
Overviewget SPListItem by ID (int)
Arguments
| Name |
Type |
Optional |
Description |
| ListItemID |
Int |
false |
Unique list item ID |
MethodList.getSPItemsWithQuery( CamlQuery, rowLimit )
Overviewget SPListItems by CAML query
Arguments
| Name |
Type |
Optional |
Description |
| CamlQuery |
String |
false |
Xml String of CAML Query |
| rowLimit |
Int |
false |
The maximum number of list items to return |
MethodList.updateItem( data )
Overviewupdate/add SPList item
Arguments
| Name |
Type |
Optional |
Description |
| data |
JSON |
false |
example:data to modified JSON object [{ id:0, title:'title123',
user:'user123'}, {id:5, title:'title124', user:'user124'}] - if id = 0 Add item
otherwise update item |
ReturnsOperation Result success: (bool) whether the
operation is success errorCode: error code, 0x00000000 for no error errorText:
error text, null for no error id: item id, -1 for error
MethodList.addItem( data )
Overviewadd a new item SPList item
Arguments
| Name |
Type |
Optional |
Description |
| data |
JSON |
false |
example:data to modified JSON object [{ id:0, title:'title123',
user:'user123'}, {id:0, title:'title125', user:'user125'}] - note: name example
'title' is case sensitive and is internal field name of the sharepoint list
column |
ReturnsOperation Result success: (bool) whether the
operation is success errorCode: error code, 0x00000000 for no error errorText:
error text, null for no error id: item id, -1 for error
MethodList.getSPView( ViewName )
Overviewpopulate jPoint object with items for particular
view
Arguments
| Name |
Type |
Optional |
Description |
| ViewName |
String |
false |
default view name is "All Items" |
MethodList.getSPView( ViewName )
Overviewpopulate jPoint object with items for Picture
List view
Arguments
| Name |
Type |
Optional |
Description |
| ViewName |
String |
false |
default view name is "All Pictures" |
Webparts
The main purpose of Webparts is to update the script on
the page so that on the next page refresh, the new script is able to run. This
class uses the WebPartPages.asmx web service.
| Name |
Type |
Description |
| Save |
Function |
Replaces contents of jPart (script webpart) that is on the page |
| getPageWebPartProperties |
Function |
Wrapper for web service that helps identify jPart on the page |
| updatejPartProperties |
Function |
Replaces local jPart properities required for easy deployment |
MethodjPoint.Webparts.Save( WebpartObj, WebpartContents )
OverviewReplaces jParts content
Arguments
| Name |
Type |
Optional |
Description |
| WebpartObj |
Object |
false |
|
| WebpartContents |
Object |
false |
|
MethodjPoint.Webparts.getPageWebPartProperties( SiteURL,
WebpartFinderID )
OverviewWrapper for web service that helps identify jPart
on the page
Arguments
| Name |
Type |
Optional |
Description |
| SiteURL |
String |
false |
|
| WebpartFinderID |
String |
false |
|
MethodjPoint.Webparts.updatejPartProperties( WebpartObj,
LocalOptions )
OverviewReplaces local jPart properities required for
easy deployment
Arguments
| Name |
Type |
Optional |
Description |
| WebpartObj |
Object |
false |
|
| LocalOptions |
Object |
false |
|
Core
The jPoint core consists of utility functions and helpful
variables that describe the jPoint class.
| Name |
Type |
Description |
| extend |
Function |
Borrowed from jQuery to extend core jPoint class |
| config |
Function |
Manage jPart (content editor webpart w/ script) setup |
| getScript |
Function |
Loads javascript files asynchronously or synchronously |
| valSiteURL |
Function |
Gets and sets base class SiteURL |
| valListName |
Function |
Gets and sets base class ListName |
| strip |
Function |
Removes white space and specials chars from a string |
| sameNames |
Function |
Compares two strings after stripping |
| Jpoint |
Variable |
Version number |
| ListName |
Variable |
Cuurent List Name |
| SiteURL |
Variable |
Current Site URL |
MethodjPoint.extend( [deep], target, object1, [object] )
OverviewThis method copies the jQuery extend method. See
http://docs.jquery.com/Utilities/jQuery.extend.
MethodjPoint.config( myjOptions )
OverviewThis method starts the configuration webpart
process
Arguments
| Name |
Type |
Optional |
Description |
| myjOptions.Local |
Custom Array |
false |
myjOptions.Local is comprised of jPart developer defined JSON objects |
| myjOptions.Plugin |
Array |
false |
|
MethodjPoint.getScript( fileURL, [blocking], [callback] )
OverviewSetup after jQuery's getScript with the exception
of an extra parameter, blocking, to load javascript files. See
http://docs.jquery.com/Ajax/jQuery.getScript. Loads, and executes, a local
JavaScript file using an HTTP GET request.
Arguments
| Name |
Type |
Optional |
Description |
| fileURL |
String |
false |
fileURL is the URL of the file to load. |
| blocking |
Boolean |
true |
blocking (optional, defaults to False) loads file asynchronously if False,
synchronously if True. |
| callback |
Function |
true |
callback (optional) is a function to be called after script is called (AND
loaded in case blocking is True). |
ReturnsTrue if jQuery's getScript was succesfully called,
otherwise False. Return value of True does not mean script has been retrieved,
only that call was made. purpose: Get: returns value of jPoint.SiteURL
MethodjPoint.valSiteURL( [value] )
OverviewGetter/Setter. Get: returns value of
jPoint.SiteURL. Set: sets value of jPoint.SiteURL with ‘value’ parameter.
Certain functions in jPoint need this variable set. If the developer does not
set the variable manually, jPoint tries to figure out the current site.
Arguments
| Name |
Type |
Optional |
Description |
| value |
String |
true |
value (Optional). If not present, function is Getter, else function is
Setter and value is String representing siteURL. |
ReturnsIf value is not present, function returns
Sharepoint’s javascript variable, L_Menu_BaseUrl, representing the siteURL. If
value is present, function just returns value.
MethodjPoint.valListName( [value] )
OverviewGetter/Setter. Get: returns value of the current
List. Set: sets value of jPoint.ListName with ‘value’ parameter. Certain
functions in jPoint need this variable set. If the developer does not set the
variable manually, jPoint tries to figure out the current list by looking for
the part of the URL after “/Lists/”.
Arguments
| Name |
Type |
Optional |
Description |
| value |
String |
true |
value (Optional). If not present, function is Getter, else function is
Setter and value is String representing listName. |
ReturnsIf value is not present, function returns the part
of URL after “/Lists/” else jPoint.ListName or “”. If value is present, function
just returns value.
MethodjPoint.strip( str )
OverviewStrips the whitespace and special characters from
the String str. It is used within jPoint to collapse a Form or List field
display name or List name so that the name can be assigned as a variable to the
parent class.
Arguments
| Name |
Type |
Optional |
Description |
| str |
String |
false |
str is a String. |
Returnsstr with whitespace and special characters
stripped out purpose: compares two names to see if they are the same except for
whitespace and special characters to abstract away from encoding and decoding
strings Used primarly to compare display names of URL parameters and Sharepoint
fields input: name1 and name2 are strings visibility: public return: true or
false
MethodjPoint.sameNames( name1, name2 )
OverviewCompares two names to see if they are the same
except for whitespace and special characters to abstract away from encoding and
decoding strings. It is used primarily to compare the display names of Form
fields and URL parameters.
Arguments
| Name |
Type |
Optional |
Description |
| name1 |
String |
false |
name1 is a String |
| name2 |
String |
false |
name2 is a String |
ReturnsTrue if strings are equal or are equal once
stripped (see jPoint.strip), else False.
OverviewContains a String of the version of jPoint
currently being used.
OverviewContains a String of the current list being
evaluated by jPoint.
OverviewContains a String of the current site executing
jPoint scripts.
|
|
|
|
|
|