Skip to main content
jP_web_icon

jPoint

Go Search
Home
jPoint Docs
Examples
Blog
  
jPoint > API > Main  

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
List
setSPObject()
Method

jPoint.Lists.setSPObject( SiteURL, ListName )

Overview

set List Item

Arguments

Name Type Optional Description
SiteURL String false SiteURL
ListName String false Sharepoint List Name

Returns

List Item object

[list name]
Items
FieldCount

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
getSPItem()
Method

List.getSPItem( ListItemID )

Overview

get SPListItem by ID (int)

Arguments

Name Type Optional Description
ListItemID Int false Unique list item ID

Returns

Nothing

getSPItemsWithQuery()
Method

List.getSPItemsWithQuery( CamlQuery, rowLimit )

Overview

get 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

Returns

Nothing

updateItem()
Method

List.updateItem( data )

Overview

update/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

Returns

Operation 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

addItem()
Method

List.addItem( data )

Overview

add 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

Returns

Operation 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

getSPView()
Method

List.getSPView( ViewName )

Overview

populate jPoint object with items for particular view

Arguments

Name Type Optional Description
ViewName String false default view name is "All Items"

Returns

Nothing

getPictures()
Method

List.getSPView( ViewName )

Overview

populate jPoint object with items for Picture List view

Arguments

Name Type Optional Description
ViewName String false default view name is "All Pictures"

Returns

Nothing

Form

The main purpose of Form is to tag and manipulate the fields on a form page or form webpart. It is important for this functionality to be cross-browser compatible and to work not only on the Form pages (NewForm.aspx, DispForm.aspx, and EditForm.aspx), but also custom webpart pages that contain a Form webpart.

Name Type Description
readForm Function Detects WSS form fields and populates the Form variables
saveForm Function Detects WSS form fields and populates the Form variables
Id Variable 0 if a new, unsaved form, value of item’s id otherwise
Schema Variable Object populated from lists.asmx -> GetListContentType
AutoSaveInterval Variable Not yet implemented in jPoint-0.3.
ItemNames Variable Array of the form field’s internal names
Items Variable Array of DOM elements pointing to each field
FieldCount Variable Length of Items array
readForm()
Method

Overview

Arguments

Nothing

Returns

saveForm()
Method

Overview

Arguments

Nothing

Returns

Id
Schema
AutoSaveInterval
ItemNames
Items
FieldCount

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
Save()
Method

jPoint.Webparts.Save( WebpartObj, WebpartContents )

Overview

Replaces jParts content

Arguments

Name Type Optional Description
WebpartObj Object false
WebpartContents Object false

Returns

getPageWebPartProperties()
Method

jPoint.Webparts.getPageWebPartProperties( SiteURL, WebpartFinderID )

Overview

Wrapper for web service that helps identify jPart on the page

Arguments

Name Type Optional Description
SiteURL String false
WebpartFinderID String false

Returns

wpsObj Object

updatejPartProperties()
Method

jPoint.Webparts.updatejPartProperties( WebpartObj, LocalOptions )

Overview

Replaces local jPart properities required for easy deployment

Arguments

Name Type Optional Description
WebpartObj Object false
LocalOptions Object false

Returns

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
extend()
Method

jPoint.extend( [deep], target, object1, [object] )

Overview

This method copies the jQuery extend method. See http://docs.jquery.com/Utilities/jQuery.extend.

Arguments

Nothing

Returns

Modified object

config()
Method

jPoint.config( myjOptions )

Overview

This 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

Returns

Nothing

getScript()
Method

jPoint.getScript( fileURL, [blocking], [callback] )

Overview

Setup 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).

Returns

True 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

valSiteURL()
Method

jPoint.valSiteURL( [value] )

Overview

Getter/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.

Returns

If value is not present, function returns Sharepoint’s javascript variable, L_Menu_BaseUrl, representing the siteURL. If value is present, function just returns value.

valListName()
Method

jPoint.valListName( [value] )

Overview

Getter/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.

Returns

If value is not present, function returns the part of URL after “/Lists/” else jPoint.ListName or “”. If value is present, function just returns value.

strip()
Method

jPoint.strip( str )

Overview

Strips 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.

Returns

str 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

sameNames()
Method

jPoint.sameNames( name1, name2 )

Overview

Compares 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

Returns

True if strings are equal or are equal once stripped (see jPoint.strip), else False.

Jpoint
Overview

Contains a String of the version of jPoint currently being used.

Variable

ListName
Overview

Contains a String of the current list being evaluated by jPoint.

Variable

SiteURL
Overview

Contains a String of the current site executing jPoint scripts.

Variable