30 August 2010

לוח שנה 2010-11 ה'תשע"א

הפעם לא הביא קוד ולגם סקריפט, אלה לוח שנה שבניתי ב- power-point.
בלוח שנה הזה אני הוספתי שקפים של תמונות (וכל אחד שיוסיף את התמונות שלו), וזו יכולה להיות אחלה מתנת חג.

לחצו כאן להורדת הקובץ

אז כולם ביחד..
בראש השנה, בראש השנה
פרחה שושנה אצלי בגינה
...
שתהיה שנה טובה,
רועי

20 August 2010

Upload form in infopath errors

 ישנו פתגם עממי שאומר "צרות באות בצרורות", זה בדיוק מה שקרה לי.


כאשר ניסיתי לעלות קובץ infopath הוא נכשל. לא יחסתי לזה חשיבות וניסיתי שוב. הפעם נסיתי לבצע Verify לפני וגם ה Verify נכשל. קובץ הלוג הראה את הצרה הבאה:

Microsoft.Office.InfoPath.Server.Converter.AspxDepthFirstWalkingVisitor.VisitChildControls(AspxControl control) at Microsoft.Office.InfoPath.Server.Converter.AspxDepthFirstWalkingVisitor.VisitDocument(AspxDocument document) at Microsoft.Office.InfoPath.Server.Converter.CssControlStateStylesVisitor.VisitDocument(AspxDocument document) at Microsoft.Office.InfoPath.Server.Converter.AspxDepthFirstWalkingVisitor.VisitControl(AspxControl control) at Microsoft.Office.InfoPath.Server.Converter.SolutionConverter.ConvertBrowserSpecificView(Solution solution, ConverterDocument converterDocument, AspxDocument aspxDocument) at Microsoft.Office.InfoPath.Server.Converter.SolutionConverter.ConvertView(Solution solution, ConverterDocument converterDocument) at Microsoft.Office.InfoPath.Server.Converter.SolutionConverter.ConvertSolution(Solution solution) at Microsoft.Office.InfoPath.Server.SolutionLifetime.Solution.<>c__DisplayClass2.b__0() at Microsoft.Office.Server.Diagnostics.FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock)

מה קשור CSS לזה שאי אפשר לעלות את הקובץ?
דבר ראשון שביצעתי זה לנקות כמה שאפשר את הקובץ מreference'ים. מסתבר זה קצת עזר.
עכשיו כאשר אני עשיתי Verify אני מקבל את ההודעות הבאות.


איזה יופי, אני מצליח לעשות Verify. עכשיו אני אעלה את הקובץ והכל יהיה בסדר...
אמרתי שצרות מגיעות בצרורות. עכשיו שאני העליתי את הקובץ קיבלתי את ההודעה הבאה:

The form template cannot be upgraded because the file name has changed since the previous version. Rename the file name to the following or change the form ID of the form template: blabla.xsn

שוב, לא יחסתי חשיבות להודעה השלישית ב Verify
אמרתי אין בעיה, קובץ : blabla.xsnקיים כבר, אז נמחוק אותו.



ראיתי שהקובץ נמצא בסטטוס deleting – אבל לנסות לא יזיק. לחצתי remove וזו ההודעה שקיבלתי.

A deployment or retraction is already under way for the solution "form-blabla-701.wsp", and only one deployment or retraction at a time is supported. at Microsoft.SharePoint.Administration.SPSolutionLanguagePack.CreateSolutionDeployTimerJob(DateTime dt, Collection`1 webApplications, SPSolutionDeploymentJobType jobType, Boolean globalInstallDlls, Boolean force)
at Microsoft.SharePoint.Administration.SPSolutionLanguagePack.Retract(DateTime dt)
at Microsoft.SharePoint.Administration.SPSolution.Retract(DateTime dt)
at Microsoft.Office.InfoPath.Server.Administration.FormTemplateCollection.<>c__DisplayClassa.b__8()
at Microsoft.Office.Server.Diagnostics.FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock)
at Microsoft.Office.Server.Diagnostics.ULS.SendWatsonOnExceptionTag(ULSTagID tagID, ULSCat categoryID, String output, Boolean fRethrowException, TryBlock tryBlock, CatchBlock catchBlock, FinallyBlock finallyBlock)
at Microsoft.Office.InfoPath.Server.Administration.FormTemplateCollection.Remove(FormTemplate formTemplate)
at Microsoft.Office.InfoPath.Server.Administration.FormTemplateCollection.RemoveFormTemplate(FormTemplate formTemplate)
at Microsoft.Office.InfoPath.Server.ApplicationPages.RemoveFormTemplatePage.<>c__DisplayClass2.b__0()
at Microsoft.Office.Server.Diagnostics.FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock)
at Microsoft.Office.Server.Diagnostics.ULS.SendWatsonOnExceptionTag(ULSTagID tagID, ULSCat categoryID, String output, Boolean fRethrowException, TryBlock tryBlock, CatchBlock catchBlock, FinallyBlock finallyBlock)
at Microsoft.Office.InfoPath.Server.ApplicationPages.RemoveFormTemplatePage.CommitData(Object sender, EventArgs e)
at Microsoft.Office.InfoPath.Server.ApplicationPages.FormTemplatePropertyPageBase.ButtonOkClick(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint))

אוקי, איך אני מוחק את זה? כדי למחוק צריך לגשת ל Timer Job Definitions

Central Admin -> Operations Tab -> Timer Job Definitions


לבחור את הJOB הנכון ללחוץ עליו ולחוץ delete



עכשיו נפנה לstsadm.
כדי לדעת מהו ID הכון של התבנית נלחץ על
stsadm -o enumformtemplates
עכשיו נקבל רשימה של כל התבניות
העתקתי את הID
כמו הדוגמה מודגשת

blabla-myXSD-2010-03-2508-17-06 urn:schemas-microsoft-com:office:infopath:blabla-myXSD-2010-03-2508-17-06

עכשיו כדי למחוק נרשום את הפקודה

stsadm -o removeformtemplate –formid “MyFormid”

כאשר MyFormid הוא הID שראינו קודם.

עכשיו שעשיתי Verify לא קיבתי את ההודעה.

בשמחה, נגשתי לעלות את התבנית.
והצרה הבאה באה...
קבלתי שהודעה על Timeout.

מה? הקובץ עד כדי כך גדול? – מסתבר שכן.

עכשיו נגשתי ל IIS(במקרה שלי 7 IIS), פניתי לapplication pool של ה Central Adminלחצתי מצד ימין על Advanced Setting ושם שיניתי את בברירת החדל מ120 ל600 בconnection time out.



 עכשיו נגשתי לweb.config של Central Admin וגם שם הגדרתי את הexecutionTimeout.

 עכשיו התג httpRuntime נראה אצלי כך

httpRuntime executionTimeout="999999" maxRequestLength="51200 "

 אחרי כל זה, שוב ניסתי לעלות את התבנית ו...יש הצלחתי


 לסיום כתב המשורר יורם טהרלב בשירו הידוע "בים בם בום" ישנן צרות גדולות יותר, אז שנתראה רק בדברים טובים...

 רועי קולבינגר

13 August 2010

Asp.Net TreeView on the client side events - JavaScript

If you wanted to use System.Web.UI.WebControls.TreeView, Did you notice that it
works only on server side?
How can I add a css style to a node?
How Ican I add JavaScript to the TreeView.


It's a trick.
You need to inherit System.Web.UI.WebControls.TreeView and System.Web.UI.WebControls.TreeNode
and create two new classes.
On the TreeNode you need to build
1. Constructors based on the base constructors.
2.  Build the new properties (line onclick,
Style, Etc.)
3. Override two methods: RenderPreText and RenderPostText
Here is a simple code for the new class TreeNode:

    public class MyTreeNode : TreeNode
    {
        #region
-- Constructors --
   
public
MyTreeNode() : base() { }
public MyTreeNode(string Text) : base(Text) { }
public MyTreeNode(string Text,
string
Value) : base(Text, Value){ }
     
public
MyTreeNode(System.Web.UI.WebControls.TreeView
owner, bool isRoot) :
base(owner, isRoot) { }
public
MyTreeNode(string Text,
string
Value, string ImageUrl) :
base(Text, Value, ImageUrl) { }
public
MyTreeNode(string Text, string Value, string ImageUrl,
string
navUrl, string target):
base(Text, Value, ImageUrl, navUrl, target) { }
        #endregion
        #region -- Properties --
private string _cssClass;
public string My_CssClass
        {
            get { return _cssClass;}
            set { _cssClass = value;}
        }
private
string _onClick;
public string My_OnClickClient
        {
            get { return _onClick;}
            set { _onClick = value;}
        }
private string _style;
public string My_Style
        {
            get { return _style;}
            set { _style = value;}
        }
private string _clientId;
   
public string My_ClientId

        {
            get { return _clientId;}
            set { _clientId = value;}
        }
private string _clientName;
public string My_ClientName
        {
            get { return _clientName;}
            set { _clientName = value; }
        }
private string _onmouseover;
public string My_Onmouseover
        {
            get { return _onmouseover;}
            set { _onmouseover = value;}
        }
        #endregion
        #region -- Overrides --
protected override void RenderPreText(HtmlTextWriter writer)
        {
            writer.AddAttribute(
              HtmlTextWriterAttribute.Class, My_CssClass);
            writer.AddAttribute(
              HtmlTextWriterAttribute.Onclick, My_OnClickClient);
            writer.AddAttribute(
              HtmlTextWriterAttribute.Style, My_Style);
            writer.AddAttribute(
              HtmlTextWriterAttribute.Id, My_ClientId);
            writer.AddAttribute(
       HtmlTextWriterAttribute.Name,My_ClientName);
            writer.AddAttribute("onmouseover", My_Onmouseover);
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            base.RenderPreText(writer);
        }
       
protected
override void RenderPostText(HtmlTextWriter writer)
        {
            writer.RenderEndTag();
            base.RenderPostText(writer);
        }
        #endregion
    }

Now you have to change the TreeView that will work with your TreeNode.
All you need is to build a constructor that reads your TreeNode
Here is a simple code

public
class MyTreeView : System.Web.UI.WebControls.TreeView
    {   
protected
override TreeNode CreateNode()
        {
            return new MyTreeNode(this, false);
        }
    }
Now you have your properties on all nodes that you have, like

Code example:

MyTreeNode
  node = new MyTreeNode(Text, ID, ImageUrl, .NavigateUrl,, "");
node.My_CssClass = "MyNode";
node.My_ClientId = "MyNode";


That all,
Roi Kolbinger

10 August 2010

Hello World SharePoint 2010

הפעם אדגים הדברים הבסיסים ב SharePoint 2010. אדגים איך יוצרים אתר בSharePoint 2010, איך עורכים דף ואיך מעדכנים פריטים. בעצם פוסט זה מראה בצורה שטחית מאוד את הצורה החדשה של ה SharePoint.
יצירת אתר בSharePoint 2010
יצירת אתר בSharePoint 2010 דומה מאוד לMOSS 2007. כל מה שצריך זה הרשאות מתאימות (SharePoint System Administrator).
דבר ראשון יש להיכנס ל SharePoint 2010 Central Administrationדרך : Start -> All Programs -> Microsoft SharePoint 2010 Products -> SharePoint 2010 Central Administration. לאחר מכן יפתח הדפדפן. יש ללחוץ בתפריט הצדדי Quick Launch על Application Management. בעמודה של Site Collections יש ללחוץ על Create site collections.
יש לבחור את Web Appliction, שם, תיאור... בדיוק כמו בMOSS 2007. בשביל ההדגמה אני בחרתי בתבנית Team Site. לאחר היצירה נגיע לדף Top-Level Site Successfully Created, שם יהיה קישור לאתר שיצרנו כרגע. כאשר נלחץ עליו נגיע לדף wikiשנקרא Home.aspx.
עריכת הדף הראשי
נלחץ על Site Actions ואז על Edit Page.
עכשיו, בשונה מMOSS 2007, הSharePoint 2010 עובד עם ריבונים (ribbon).

כל WebPart מקבל את המאפיינים שלו עם הריבונים שהוא משתמש. הוספת WebPart נעשית בדרך הבאה: בתפריט הריבונים בחלונית הEditing Tools יש ללחוץ על Insert. בריבונים עכשיו יש אפשרות להוסיף WebPart, רשימות, ליצור רשימות ועוד.



כאשר נלחץ על הוספת WebPart נקבל תפריט WebPart'ים. כמו בגרסאות הקודמות של SharePoint בוחרים את הקטגוריה של הWebPart ולאחר מכן את הWebPart עצמו ולוחצים Add.



עריכת פריט

עוד דבר נחמד ויעיל שלא היה בגירסה הקודמת זה כאשר רוצים ליצור/לעדכן פריט, במקום הפניה לדף נפרד, הפעם נשארים באותו דף, רק שהפעם, קופץ חלון popup עם הגדרות הפריט שאנו רוצים ליצור.לעדכן.


שימו לב שלא יצאנו מהדף וזה רק popup.
תהנו,
רועי קולבינגר

07 August 2010

PowerShell בSharePoint2010


בהמשך לפוסט הקודם הפעם אסביר על PowerShell בSharePoint2010

בSharePoint2010 הוסיפו לנו tool עבור הPowerShell שנקרא SharePoint 2010 Management Shell.


דוגמא

בדוגמא הבא ארצה לקבל בקובץ אקסל את האתרים בשרת הSharePoint. בשביל זה אצטרך להשתמש בpipe שיעביר לקובץ csv שאקסל יודע לקרוא. כמו כל פניה בSharePoint צריך לפתוח את הWeb Application , לאחר מכן את הSite Collection וכו..
נרשום את הפקודה

Get-SPSite Get-SPWeb Select url,title Export-Csv



לאחר שרשמתי את הפקודה התבקשתי לרשום את הנתיב לשמירת הקובץ CSV.


כל זה בשורה אחת ב PowerShell, ורק תחשבו כמה זמן זה חוסך זמן במקום בניית console application. דבר אחד רק רציתי להזכיר, כאשר פותחים SPSite וSPWeb חייבים להוריד אותם מהזיכרון בסוף – כך הקוד למעלה לא יעיל. כדי להפוך אותו ליעיל צריך לגדיר משתנה ($Site = Get-SPSite) ואז בסוף למחוק אותו מהזיכרון ($Site.Dispose).


עזרה
כמו בפוסט הקודם שהסברתי איך לפנות לעזרה בעזרת המתודה Get-Help. כדי לראות את הפרוצדורות של SharePoint בPowerShell יש להקליד את הפקודה הבאה:
Get-command -noun sp*
מכיוון שכל הפרוצדורות של SharePoint מתחילות בSP כמובן.

בהצלחה,
רועי קולבינגר