ĐÀO TẠO DOANH NGHIỆP : SỞ KHOA HỌC CÔNG NGHỆ TỈNH ĐỒNG NAI

ENTERPRISE TRAINING: DONG NAI DEPARTMENT OF SCIENCE AND TECHNOLOGY.

HÌNH ẢNH TẬP HUẤN LỚP SHAREPOINT WORKFLOW VÀ KIẾN TRÚC SHAREPOINT

PHOTOS OF SHAREPOINT WORKFLOW AND ARCHITECTURE CLASS.

HÌNH ẢNH TẬP HUẤN LỚP SHAREPOINT WORKFLOW VÀ KIẾN TRÚC SHAREPOINT

PHOTOS OF SHAREPOINT WORKFLOW AND ARCHITECTURE CLASS.

Thursday, August 28, 2014

Sharepoint Search crawl success without new data

Hello all,

I got an issuse about search crawl:

Issue:

          When i update data (Ex: A->B) then i start crawl data but data still got A value.

Solution:

          I Index Reset in search service application and configure scope again then i crawl full data => i got new result (B value). If you meet problem about people search without item, remember check sps3://yourwebapp:port in content source

Thanks all.

Friday, August 15, 2014

Sharepoint Debug Timer Job

Deploy Timer Job >> then restart sharepoint timer services >> then go back visual studio >> tool Attach to process
Go to Central Admin >> Monitoring >> Review Job Definitions 

Click to your timer job then click run now and start debug

Note: Each time  to debug, build then deploy then restart timer services

Wednesday, August 6, 2014

get selected value dropdown jquery

How to get selected value of DropDownList (server control) using JQuery

$("select[id$=ddlContentType]").change(function () {
var selectedval = $('select[id$=ddlContentType] option:selected').text();
alert(selectedval);
});

Front End


1.  JQUERY
2.  JSON
3.  CSS

Sharepoint 2010 - File Uploading with HttpFileCollection

Upload document to sharepoint library using HttpFileCollection

Hello everybody,

Today I post this article to client can upload document from their computer, if we use FileUpload1.PostedFile.FileName method we can’t upload document. Because, that code only execute in server (server setup sharepoint). So I write this article using HttpFileCollection. See details:
 
Code inline
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UploadDocHttpFileCollectionUserControl.ascx.cs" Inherits="SharePointSample.UploadDocHttpFileCollection.UploadDocHttpFileCollectionUserControl" %>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
    Text="Upload document to sharepoint library" />

Code behind
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using System.Web;
using System.IO;

namespace SharePointSample.UploadDocHttpFileCollection
{
    public partial class UploadDocHttpFileCollectionUserControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            using (SPSite spSite=new SPSite(SPContext.Current.Web.Url))
            {
                using (SPWeb spWeb= spSite.OpenWeb())
                {
                    spWeb.AllowUnsafeUpdates = true;
                    SPList spList = spWeb.Lists["Shared Documents"];
                    SPFile spFile = UploadDocument(spWeb, spList.Title);
                    SPListItem spListItem = spFile.Item;
                    spListItem["Title"] = spListItem.Name;
                    spListItem.Update();
                    spWeb.AllowUnsafeUpdates = false;
                    Response.Redirect(HttpContext.Current.Request.Url.AbsoluteUri);
                }
            }
        }

        public SPFile UploadDocument(SPWeb spWeb, string documentLibraryName)
        {
            string result = "success";
            HttpFileCollection hfc = HttpContext.Current.Request.Files;
            SPFile file = null;
            for (int i = 0; i < hfc.Count; i++)
            {
                try
                {
                    // stream the data into a new SharePoint list item
                    string file_name = Path.GetFileName(hfc[i].FileName);
                    var folder = spWeb.GetFolder(documentLibraryName);//documentLibraryName (Shared Documents)
                    var files = folder.Files;

                    byte[] file_content = new byte[Convert.ToInt32(hfc[i].ContentLength)];
                    hfc[i].InputStream.Read(file_content, 0, Convert.ToInt32(hfc[i].InputStream.Length));
                    file = files.Add(documentLibraryName + "/" + file_name, file_content, true);
                }
                catch (Exception ex)
                {
                    result = "failure " + ex.Message + " " + ex.InnerException;
                }
            }
            Response.Write(result);
            return file;
        }
    }
}

Demo

Monday, August 4, 2014

ZTree in sharepoint

ZTree In SharePoint – CheckBox Operation Demo

Hello everybody, i wrote this article to support document system. it very useful, i can apply it for document properties. Example: when you create document then select the Department from tree. you can apply this article.
Download Project at here
Go to page http://www.ztree.me/v3/main.php then And download Ztree or download at here
Open WebSite then choose ZTree_v3
I will demo example with checkbox Operation
Now we will apply it to SharePoint, Open visual studio and new empty project
Add new Visual Web Part
Now we Add map Layouts folder
Add new folder ZTree
Add new folder js in Ztree folder
Add new existing items to js folder in project zTree_v3
Add new folder css in Ztree folder then add new existing items to css file in project zTree_v3
Add new folder img in Ztree folder then add new existing items to images file in project zTree_v3
Add new folder diy in img folder then add new existing items to images file in project zTree_v3
After add resource finished, the structure look like
Copy Html to user control
<h1>Checkbox Operation</h1>
<h6>[ File Path: excheck/checkbox.html ]</h6>
<div class="content_wrap">
       <div class="zTreeDemoBackground left"><ul id="treeDemo" class="ztree"></ul> </div>
       <div class="right">
              <ul class="info">
                     <li class="title"><h2>1, Explanation of setting</h2>
                           <ul class="list">
                           <li class="highlight_red">Must set setting.check attributes, see the API documentation for more related contents.</li>
                           <li><p>Linkage relationship between parent and child nodes:<br/>
                                         check: <input type="checkbox" id="py" class="checkbox first" checked /><span>affect the parent</span>
                                         <input type="checkbox" id="sy" class="checkbox first" checked /><span>affect the child</span><br/>
                                         uncheck: <input type="checkbox" id="pn" class="checkbox first" checked /><span>affect the parent</span>
                                         <input type="checkbox" id="sn" class="checkbox first" checked /><span>affect the child</span><br/>
                                         <ul id="code" class="log" style="height:20px;"></ul></p>
                           </li>
                           </ul>
                     </li>
                     <li class="title"><h2>2, Explanation of treeNode</h2>
                           <ul class="list">
                           <li class="highlight_red">1), If you need to initialize the node is checked, please set treeNode.checked attribute. See the API documentation for more related contents.</li>
                           <li class="highlight_red">2), If you need to initialize the node's checkbox is disabled, please set treeNode.chkDisabled attribute. See the API documentation for more related contents and 'chkDisabled Demo'.</li>
                           <li class="highlight_red">3), If you need to initialize the node don't show checkbox, please set treeNode.nocheck attribute. See the API documentation for more related contents and 'nocheck Demo'.</li>
                           <li class="highlight_red">4), If you need to change 'checked' to other attribute, please set setting.data.key.checked attribute. See the API documentation for more related contents.</li>
                           <li>5), By the way, please see the API documentation for 'treeNode.checkedOld / getCheckStatus / check_Child_State / check_Focus'.</li>
                           </ul>
                     </li>
              </ul>
       </div>
</div>
Continue copy JS and css link and update path to js and css look like
Open and find ./img and replace to ../img
Deploy then add web part look like
The next article, I will guide step by step apply from database to ZTree.

My GOD will bless to all of you. Thanks.