Showing posts with label share point. Show all posts
Showing posts with label share point. Show all posts

Sunday, April 7, 2013

new and update for share point 2013


The below are the updated and new things have been added  to Share Point 2013 by march.
New:
1. XLIFF interchange file format .click here  for more
2.Customize  page layouts for a catalog-based site . For Brief Description
3.BCS connection objects
Updated:
1.BCS REST API reference
2.Create external event receivers
3.e Discovery 
4.eDiscovery and compliance
5.design packages 

Monday, November 12, 2012

How to disable client side validation in sharepoint 2010

The validation controls are used get the right input from users.so i have used four validation controls for four text boxes in my web part.Then i was disable those validation based on page mode on server side.If the mode is display mode i will turn on all the validations on site.To turn on the validations we have to set the EnableClientScript property to false
WebPartManager wpmr = WebPartManager.GetCurrentWebPartManager(Page);
Respose.Write(wpmr.DisplayMode);
if (wpmr.DisplayMode == WebPartManager.EditDisplayMode)
{
ReOrderName.EnableClientScript = false;
RaOrderQuantity.EnableClientScript = false;
ReOrderAmt.EnableClientScript = false;
RaOrderAmt.EnableClientScript = false;
}
else if(wpmr.DisplayMode == WebPartManager.DesignDisplayMode)
{
ReOrderName.EnableClientScript = True;
ReOrderAmt.EnableClientScript = True;
}

Monday, October 15, 2012

How to add external script(JS) on page in sharepoint 2010

Here i will explain how to import the external java script file into specified share point site web page.To add the file reference by using  a class "script link" which will be used to request scripts by the time of page rendered in share point 2010.We will add the reference both client side and sever side to page using this below piece of code.
Client Side:
<SharePoint:ScriptLink ID="sl" name="/_layouts/Jscripts/testadd.js" runat="server" Defer="false"/>
Server Side:
By using the below method we can access script on server side.The Register method contains the there variable which are page name,script file name and localizable value .
ScriptLink.Register(this.Page, "/_layouts/Jscripts/testadd.js", false);

 

Monday, October 1, 2012

How to add images/files to document library in sharepoint 2010

In previous post we have seen how to get the updated items from the document library and read the excel file data from document library.Here i will shown how to add the image files to document library/List .For this i have been converted  the attachment file to string format then get the size using some length and memory of this.Then using document  library class the result Data has added to library after check in .
XPathNavigator dX = MainDataSource.CreateNavigator();
XPathNavigator XN = fileAttach.Current;
byte[] converted_attachment = Convert.FromBase64String(XN.ToString());
double filelength= converted_attachment.Length;
double memoryb = 2048 * 2048;
double resultfSize = filelength / memoryb;
if (resultfSize < 8 && resultfSize != 0)
{
int fln = converted_attachement[32] * 2;
byte[] fb = new byte[fln];
for (int i = 0; i < fb.Length; i++)
{
fb[i] = converted_attachement[24 + i];
}
string[] filenameparameter = System.Text.UnicodeEncoding.Unicode.GetChars(fb);
string ResultfName = new string(Filenameparameter);                            
byte[] Result_Data = new byte[converted_attachement.Length - (24 + fln)];
for (int i = 0; i < Result_Data.Length; i++)
{
Result_Data[i] = converted_attachement[24 + fln + i];
}
}
SPDocumentLibrary dl = (SPDocumentLibrary)Web.GetList(Site.ServerRelativeUrl + "/DesiredLibraryName");
SPFolder spfolder = dl.RootFolder;
SPFileCollection spf = spfolder.Files;
SPFile sf = spf.Add(spfolder.Url + "/" + DateTime.Now, Result_Data);
SPListItem spf_item = sf.Item;
spfitem["Filename"] = resultfName;
spfitem.Update();
spfitem.File.CheckIn("WF CheckIn", SPCheckinType.MajorCheckIn);


Monday, September 24, 2012

how to Passing parameters into a Modal Dialog Window in sharepoin 2010

The share point provide a class for crating modal dialog box i:e SP.UI.ModalDialog.Here i have given an example to create a dialog box for account result by using parameters.The parameter will be assign using args property

function ResultDialog() {
var options = {url: 'Account/Reports.aspx', autoSize: true,title:' 
args: { amt: 'Amt_Tot', category: 'sales' },dialogReturnValueCallback: Result
};
SP.UI.ModalDialog.showModalDialog(options);

}
For the above model dialog box i passed two arguments to display the sales amount regarding order.The reports.aspx has hold the resultant output ,so i dialog box url set to this page here.

Saturday, August 25, 2012

How to create Profile programmatically in sharepoint 2010

In this post i will given a code to create profile in share point 2010 .Here i have used Userprofilemanager class to do this.Then using this i will check the the whether the user name is exist or not.If it is not exit ,it will create as user profile
using (SPSite sc = new SPSite(SPContext.Current.Site.Url))
{
SPServiceContext c = SPServiceContext.GetContext(sc);
UserProfileManager upm = new UserProfileManager(c);
SPUser su = sc.RootWeb.CurrentUser;
if (!upm.UserExists(su.LoginName))
{
upm.CreateUserProfile(su.LoginName);
}
}

Tuesday, July 24, 2012

sharepoint 2013 tutorial and download

Recently share point 2013(beta) has been released with new features.The complete overview of version and features are explained briefly in the below links

1. share point 2013 tutorial
2. share point 2013 developer tutorial
3. Develop apps for share point 2013 tutorial
4. Building apps office
3. share point 2013 download

Monday, May 28, 2012

how to create a custom webpart in sharepoint 2010

Title:How to create a custom web part in share point 2010

Description:
In previous post we known how to create and filter the list in SharePoint.Here i will show how to create a custom web part in share point 2010.For this i will use a class SPWebPartCollection to get the existing web parts in page ,then add a new web part to page by creating object for web part.we have two chrome state properties.one is Minimized which can do the border in minimized state and other one is none which gives the normal state  .Chrome type property has for attributes .those are Title only which give only title bar,Border only which gives only border,Title And Border which give both title and border .None which give no one .After set the properties we can add the custom web part to web part list sing add() method

if(inplist!=null && set!=null)
{
using (SPSite ss = new SPSite(URL) 
{   
using (SPWeb sW = ss.OpenWeb())   
{     
SPWebPartCollection webpartscollection = sw.GetWebPartCollection(pagrurl,Storage.Shared);      
WebPartToBeAdded wptest = new WebPartToBeAdded();      
wptest.ZoneID = "zoneid";     
wptest.Title = "My first webpart";
wptest.ChromeState = System.Web.UI.WebControls.WebParts.PartChromeState.Minimized;
wptest.ChromeType = System.Web.UI.WebControls.WebParts.PartChromeType.TitleAndBorder;  
webpartscollection.Add(wptest);      
sw.Update();    
} 
}
}    

Monday, May 21, 2012

How to programmatically download file from sharepoint

  Here i will show how to get the documents from share point site.For this we can use path of document to download or to do any file operation in folder.The below example has the path of the url of document(testfilename) i:e http://www.localwebtest.net/TestDownloadimageSP/Document/results.doc".If you  what to get the data we should use the web client class.For this we have to add the System.Net.Web Client name space
WebClient webc = new WebClient();
webc.UseDefaultCredentials = true;
byte[] testbytedata = webc.DownloadData(path);
testfilename="pathofdocumnet";
FileStream fst = new FileStream(testfilename, FileMode.Create, FileAccess.ReadWrite);
BinaryWriter biw = new BinaryWriter(fst);
biw.Write(testbytedata);

create custom list view and filter the list data in sharepoint 2010

SharePoint has one of the best feature i:e we can  create a custom  view for list.Basically the view can used to display the user tasks based on the login in share point and we can filter the list data using as our filter condition.Here i will show how to create a view for subjects list and filter the data as per author
using (SPSite Site = new SPSite(url))
{
using (SPWeb sWeb = Site.OpenWeb())
{
SPList sList = sWeb.Lists["subjects"];
SPViewCollection sViewCollection = sList.Views;
string testViewName = "TestView";
System.Collections.Specialized.StringCollection testviewFields = new System.Collections.Specialized.StringCollection();
testviewFields.Add("Id");
testviewFields.Add("Name");
testviewFields.Add("Author");
testviewFields.Add("Group");
string spquery = "<query><where><eq><fieldref name="\"Name\"/">" +
                    "<value type="\"author\"/">Testview</value></fieldref></eq></where></query>";
sViewCollection.Add(testViewName, testviewFields, spquery, 100, true, false);
sWeb.Update();
}
}

Bel