DCSIMG
Dor Rotman`s Blog
כנסו כנסו! SharePoint Designer 2007 להורדה בחינם!
זו לא מתיחה של 1 באפריל: Microsoft Office SharePoint Designer עכשיו ניתן להורדה בחינם, מאתר ההורדות של מיקרוסופט!
Screenshot

ההודעה פורסמה ביום חמישי, וכבר עכשיו ניתן להוריד את התוכנה בקישור הזה.
המשמעות היא שמעתה כל לקוח שמעוניין בכך, יכול לעצב לעצמו Master Pages, Workflows, Page Layouts ועוד, בלי לרכוש רישוי בנפרד! (הרי SPD לא היה באף חבילת Office..)
 
זה צעד מצוין מצד מיקרוסופט, שאני בטוח שיגביר את מיצוי היכולות מ-MOSS ויאפשר למשתמשים לבצע קסטומיזציות יותר חזקות באתרים שלהם. בפרט, ה-Power Users ברחבי האירגון יוכלו לעבוד על האתרים הצוותיים\מחלקתיים שלהם דרך הכלי הזה, וכך התלות באדמיניסטרטור פורטל תוכל לקטון.
 
למי שרוצה לשמוע קצת למה הם עושים את זה, הנה וידאו שבו מדבר תום ריזו (Product Manager) על הצעד:
 
מזל שההודעה פורסמה ב-2 באפריל, אחרת אף אחד לא היה מאמין.. :)
 
אז יאללה, רוצו להוריד!
 
דור רוטמן.
How to Force Redirection From HTTP to HTTPS – The Easy (ISA) Way!

Yesterday I wrote a post about redirecting HTTP to HTTPS, which uses an IIS technique to perform the redirection. However, many IIS websites are connected to the internet using Microsoft ISA Server. So here’s an even easier technique to perform this:

1. Open the ISA Server snap-in in the Management Console, and open the the web server’s rules properties.
2. Go to the Bridging tab.
3. Check the box that says Redirect requests to SSL port.
4. Uncheck the box that says Redirect requests to HTTP port
5. Click OK.

isa-ssl

And that’s it!

Note that on other versions of ISA Server this window might look different, but I assume you got the idea… :)


Dor Rotman.

How to Force Redirection From HTTP to HTTPS on IIS 6.0

Lets say your clients write HTTP://myserver.lab to get to your site, but you want to redirect them automatically to an SSL secured site: HTTPS://myserver.lab. Unfortunately, performing this redirection in IIS 6 not a regular feature, but there’s a nice trick to do it.

Note:

  • This process will cause some downtime and disconnect all active user sessions on the website.
  • If you have a server farm, make sure you perform this procedure on all servers.


Instructions for making your site accept HTTPS only:

I assume you already have a website set up on port 80.

1. Open IIS and right click on your website. Click Properties and go to the Web Site tab.
You can see that it uses port 80.

Properties Dialog

2. Now change the port to 81, or any other port you’d like your firewall to block.
That’s right, we’re blocking it since we don’t clients to ever reach our website on unsecured communications.

3. Now type in 443 for the SSL port. That’s the standard. Click OK.

4. Create a new website in IIS. Call it “mydomain.lab Redirect” (for example) and map it to port 80. If you’re using a host header, use the same host header as your original site.

Wizard

This site is intended to be empty. We will use an IIS technique to redirect our clients.

5. This is how our IIS server looks like:


The real site is on port 81 with SSL on, and the Redirect site is on port 80.

 

6. Right click on the “mydomain.lab Redirect” website and click Properties. Go to the Home Directory tab.


7. Choose A redirection to a URL. Type in the address of your website, with an HTTPS protocol.

Now here are your choices:

  • If you want to redirect to the same exact address, only on HTTPS – that’s all you need to do.
  • If you want to redirect to a certain page, like a login page – check the “The exact URL entered above” box.
  • If this redirection is permanent – and I guess it is: Check the 3rd box. It will send a different HTTP Redirect response which will tell browsers to update their cookies accordingly.

Finally, click OK and test the new configuration.

So what did we do?

We changed the listening port of the website from 80 to something else, and created a different “redirector” website that listens to it. The redirector tells the browser to switch to SSL, and now the new HTTP request goes to the original website.

Now just don’t forget to block the new port you chose for the website!

Enjoy. :)

Dor Rotman.

My Developer Academy 3 experience
השבוע נכחתי ב-DevAcademy3, ביום מרוכז במיוחד של טכנולוגיות ומלא בהרצאות.
הכל התחיל בכלל בהזמנה שפורסמה בבלוג של מיכל לקבוצת בלוגרים, איך אפשר לסרב? :)
 
ככל שמועד הכנס התקרב, שמענו עליו דברים מעניינים יותר ויותר, כולל ניסוי שגיא בורשטיין החליט לעשות עם twitter. הבחירה ב-twitter היתה מאוד מגניבה, היות וזו מדיה חדשה ומסקרנת שמתחילה לצבור תאוצה בארץ.
 
למי מכם שתוהה מה זה לכל הרוחות twitter, הנה הסבר:
מה שהוידאו הזה לא מציין הוא יכולות התגובה של טוויטר – בעיניי זה יותר כמו חדר-צ’אט שמתנהל לאט לאט לאורך היום. ככל שכותבים יותר, כך מקבלים יותר תגובות, וכך מערוץ שידור חד-כיווני – זה הופך לערוץ תקשורת רב-כיווני.
 
אז נחזור לכנס: הוא נפתח מוקדם מהרגיל – ב-9 בבוקר כבר התחילו ההרצאות, אולי כדי להימנע מהפקקים הקבועים ל-Airport City. אמנם הפקקים היו משמעותיים, אבל הצלחתי להגיע באיחור קל בלבד, ולצפות בחלק מהרצאתו המעניינת של פבל יוסיפוביץ’ על כוחה של שפת C#.
 
תוך כדי ההרצאה התחלתי לבדוק מה קורה ב-twitter: אנשים מעדכנים איפה הם בהרצאות, מה אומרים בהן, ומה מעניין קורה בכנס.
בהמשך התקבצנו אנשי ה-twitter באולם בו תעבור הרצאת ה-Silverlight של גיא. מצאנו לעצמנו שורה פנויה ופתחנו בה מיני-בלוגיה. :) כך נראה live twittering:
live twittering
לצערי הרב שכחתי את הטלפון המגניב שלי בבית, אז נאלצתי לכתוב מהנוקיה הפשוט שלקחתי מהאוטו דרך האינטרנט הסלולרי (WAP), ובזמן שכולם מקלידים לידי משפטים בקצב מסחרר, אני בקושי מקליד אות עם המקלדת הזו..
 
אז גיא העביר את ההרצאה שלו ובנה את ה-Twitter Client באמצעות Silverlight, ואנחנו הקלדנו במרץ מגוון משפטים משועשעים, שחלקם אף הוקרנו על המסך. תוך כדי ההקלדות והחיפוש אחר תגית DevAcademy3 בטוויטר, גילינו שזה נהפך לטרנד מס’ 2 ברשת לזמן קצר: אלה הן המילים הטרנדיות ביותר ע”פ האלגוריתם של חיפוש טוויטר:
TwitterTrend
כמובן שמהר מאוד הטרנד נעלם, אך בינתיים קובי מגנזי הספיק להפציץ בהרבה טוויטים על הכנס, ולזכות בעכבר מגניב. :)
 
בהמשך כל אחד הלך להרצאות שעניינו אותו, תוך כדי עדכוני טוויטר כמובן. אני המשכתי משם להרצאה על תכנות מקבילי של סשה גולדשטיין, שהיתה מעניינת ומסובכת כאחד.. ומצד שני, למה אפשר לצפות כשמדברים על נושאים כאלה?
לאחר מכן האזנתי לשי פרידמן מדבר על שפות דינמיות והקשר שלהן ל-.NET.. היה נחמד מצידו לתת עותקים של Vista לכל מי שאי פעם כתב ב-VB או שמפתח ב-Office. :)
לסיום, ניסיתי להבין מה בדיוק עומד מאחורי ה-ASP.NET MVC Framework, אך לקראת סופה, התשישות והצינון ניצחו אותי, אז הלכתי לראות מה קורה על ספות הבלוגרים בקומה התחתונה.
image
 
בסוף היום הלכנו למסעדת Air Cafe, בלוגרים ומרצים, ונהנינו מארוחה מגניבה שאירגנה מכללת סלע. היה משעשע וטעים. :)
 
לסיכום – היה כנס כיפי ומעניין. התכנים היו מגוונים מאוד, והיה כיף לפגוש את כל האנשים – אלה שאני פוגש בדרך כלל בכל האירועים האלה, ואלה שמזמן לא פגשתי. :)
 
 
תודה רבה למיקרוסופט על ההזמנה!
אלבום התמונות המלא מהכנס זמין ב-Skydrive שלי.
 
דור רוטמן.
 
 
דרושים מפתחי SharePoint!
החברה בה אני עובד, Omnisys, מחפשת מתכנתי .NET עם ניסיון פיתוח בטכנולוגיות SharePoint.
 
דרוש ניסיון של שנתיים בפיתוח .NET, ידע ב-C#, ASP.NET, Web Services, ניסיון בעבודה עם טכנולוגיות SharePoint ורצוי ספציפית MOSS.
 
יחסי אנוש טובים – חובה. :)
 
מעוניינים? מעוניינות? שלחו אליי קורות חיים – dorr@omnisys.co.il
 
דור רוטמן.
Omnisys Logo
    
Converting Word 2007’s WdColor to .NET Color Class

Here’s a small snippet that I wrote for converting a Microsoft.Office.Interop.Word.WdColor object to a System.Drawing.Color object.

The WdColor enum values are actually stored as BGR and not RGB. So you must parse the number and isolate the R,G and B elements to re-assemble them into a .NET Color class.

Also, during runtime, sometimes a color object gets a value that isn’t listed in the enum. I don’t understand why this happens, but I’m guessing it’s either me being silly or the COM wrapper being silly. :)
The characteristic of the strange value is that it has an Alpha element as well as RGB elements.

I wrote my code to fit both cases, yet you may choose to change it to fit only the enum values.

So here’s the code:

public static class Extensions
{
    /// <summary>
    /// Converts a Microsoft.Office.Interop.Word.WdColor object to a 
    /// System.Drawing.Color object.
    /// If Word's color only contains RGB values without an alpha value,
    /// the alpha value will be set to 255.
    /// </summary>
    public static Color ToColor(this WdColor originalColor)
    {
        // Cast to numeric value so we can isolate RGBA elements
        int wordColor = (int)originalColor; 
 
        // Isolate alpha element. Shift right to set its range to [0-255].
        int alphaTemp = (int)((wordColor & 0xFF000000) >> 24);
        // Check that it's not completely transparent. If so, make it visible.
        int alpha = (alphaTemp == 0) ? 255 : alphaTemp;
 
        // Isolate R,G,B elements.
        int r = (wordColor & 0x000000FF);
        int g = ((wordColor & 0x0000FF00) >> 8);
        int b = ((wordColor & 0x00FF0000) >> 16);
        
        return Color.FromArgb(alpha, r, g, b);
    }
}

Please note that this is written as an Extension Method, which means it will look like a member of WdColor.

Usage:

// Get the background color from the cell and convert it to Color class
WdColor backgroundColor = newRow.Cells[4].Shading.BackgroundPatternColor;
Color myColor = backgroundColor.ToColor();

I would appreciate feedback regarding the Alpha strangeness. :)

Enjoy..

Dor Rotman.

Quick Tip: Displaying Hexadecimal Values in VS
במצבים מסויימים הרבה יותר נוח לצפות בערכים מספריים בבסיס 16, כלומר Hexadecimal, במקום בבסיס 10 הדצימלי, שאנו רגילים אליו. יש לכך יתרון כשעוסקים בצבעים – מאוד קל להפריד את מרכיבי ה-RGB מתוך המספר המוצג.
 
ניתן להגדיר ש-Visual Studio יציג מספרים ב-Quick Watch בבסיס זה בצורה מאוד פשוטה. במקרה גיליתי את זה היום וזה עשה לי את החיים הרבה יותר קלים :)
 
אז קדימה:
1. דבגו את התוכנה להנאתכם והגיעו למשתנה מספרי כלשהו שאת ערכו אתם מעוניינים להציג
2. עמדו עם העכבר מעל המשתנה כך שיוצג ערכו ב-Tooltip
3. לחצו על ה-Tooltip באמצעות הלחצן הימני להצגת התפריט
4. בחרו את Hexadecimal Display – וזה הכל!
 
 image
 
באותה קלות אפשר תוך כדי debugging לעבור חזרה לבסיס הדצימלי וביניהם.
 
איזה כיף :)
 
 
דור רוטמן.
SharePoint Performance Optimization Whitepaper
ואם כבר אנו עוסקים בנושאי ביצועים של חוות SharePoint, כדאי מאוד ללמוד מנסיונם של אנשי ה-IT של מיקרוסופט: הם הקימו תשתית SharePoint פנימית המשרתת 154 אלף עובדים.
 
פורסם לאחרונה Whitepaper המתאר את אופן בחינת הביצועים הנוכחיים, המסקנות, האופטימיזציות שנעשו, וכן הלקחים וההמלצות ללקוחות.
 
כדאי מאוד לקרוא: להורדת ה-Whitepaper לחצו כאן.
 
דור רוטמן.
 
עבודה עם רשימות גדולות ב-SharePoint
לאחרונה עלה אצלי בעבודה כבר כמה פעמים נושא הרשימות הגדולות ב-SharePoint. כמה פריטים מותר לשים ברשימה או בתיקיה ולשמור על ביצועים טובים?
 
אז הנה כמה המלצות בנושא:
  • לא לעבור את ה-2000 פריטים בתצוגה \ תיקיה
  • לאנדקס עמודות שמבצעים עליהן סינונים תדירים
  • בפיתוח, בשום אופן לא להשתמש ב-foreach, אלא להריץ שאילתת CAML. תמיד שאילתת CAML תהיה מהירה יותר מאנומרציה של אובייקטים.
הנה תמונה מתוך Whitepaper שאספר עליו בהמשך. היא מציגה הבדלי מהירות שאילתא בין השיטות השונות. מדובר על רשימה עם 100,000 פריטים, שרוצים לדלות ממנה 100 פריטים, תוך כדי שיש עומס על האתר, וללא עמודות מאונדקסות. ניתן לראות ששימוש בשאילתת CAML במסגרת SPQuery היא הרבה יותר מהירה מאשר foreach, שהזמן שלקח לו חרג מהגרף ולכן כלל לא מופיע בו.
SharePoint Limits Graph, Copyright Microsoft
 
המסקנה היא פשוטה: מי שרוצה להשתמש ב-SharePoint כבסיס נתונים מרכזי ולאחסן ברשימה אחת כמות פריטים גדולה כל כך, חייב לכתוב ממשק תצוגה משלו, על מנת לשמור על ביצועים סבירים.
 
למי שרוצה להתעמק, מומלץ לקרוא שני מסמכים חשובים:
1. מאמר Plan for Software Boundaries ב-TechNet המפרט כמויות מומלצות
2. ה-Whitepaper המעולה Working with large lists in Office SharePoint Server 2007, שפורסמם ב-MSDN כבר לפני שנה וקצת, ומשם לקוח הגרף שלמעלה.
 
דור רוטמן.
Podcasting Kit for SharePoint
החודש יצא Release חדש ל-SharePoint Podcasting Kit, פרויקט ה-CodePlex עבור פלטפורמת MOSS. יעודו של הפרויקט הוא לספק תבנית אתר למדיה כגון סרטים, קבצי אודיו וכו’.
תמונה שווה אלף מילים:
 
הפרויקט לא סתם יושב ב-CodePlex, אלא הוא קוד-פתוח ואינו מוצר של מיקרוסופט, אלא של מספר חברות הפועלות יחד איתה בפיתוחו.
 
מי שרוצה להקים אתר User Generated Content בתוך האירגון שלו לקבצי מדיה ירוויח מהמוצר החינמי הזה מאוד, כי הרי כבר קנה ושילם על MOSS, וזו עוד דרך מצויינת לנצל את יכולות המערכת.
 
עם זאת, מי שרוצה להשתמש ב-Podcast Kit בקרוב צריך להתאזר בסבלנות רבה בעת יישומה, שכן המוצר עוד לא מוגמר: ההתקנה ידנית ברובה, והתיעוד לוקה בחסר. כל חודש יוצאת גרסה, כאשר ה-Major Release הבא מתוכנן לדצמבר.
 
בכל אופן, הפתרון בהחלט מעורר השראה ושווה מבט, כולל לתוך הקוד שלו.
 
דור רוטמן.
First Look: Office 14 for Web
במסגרת כנס ה-PDC שמתקיים בימים אלה, מבוצעות המון חשיפות לטכנולוגיות ומוצרים חדשים. אז אם אתם פה בארץ, כמוני, ורוצים להתעדכן - הדרך הטובה ביותר היא לשים עין על דף הבית של Channel9.
 
אמנם מירון כבר קישר לוידאו, אבל חשוב לי לציין שאנחנו סוף סוף רואים תגובה מצד מיקרוסופט לכל יישומי המשרד הממוחשב מבוססי Web 2.0 למיניהם, ובמיוחד לגוגל. נכון שכבר ראינו את Office Live, אבל הפעם מדובר על יכולות הרבה יותר חזקות.
 
בין הדברים המגניבים שבוידאו:
  • גרסאות Web למוצרי Office המאפשרים עריכה של המסמכים
  • תמיכה בריבוי דפדפנים, כגון Firefox – נקווה שמלאה
  • יכולת עריכה מקבילית לאותו מסמך (סוף סוף!)
  • הטמעת מצגות בבלוג (embed, כמו הסרט שלמטה)
  • רינדור מסמכים באמצעות Silverlight (אני מניח שזו התשתית ל-embedding)
יש בסרט צילומי מסך והדגמות, שווה לראות:
 
זהו, רשמית פתחתי תגית Office 14 בבלוג. מקווה שייצאו עוד הכרזות מעניינות בקרוב.. :)
חבל רק שעוד לא נתנו תאריך ל-SharePoint Services של Azure. זה צריך להיות מאוד מעניין..

דור רוטמן.
דרושים תותחי ווב!
לחברת Omnisys בה אני עובד, דרושים תותחי Web למשרת Professional Services.

מי ש-HTML ו-CSS הן לא מילים גסות עבורו, ושיש לו היכרות עם SPS או MOSS, ימצא כאן אתגר מקצועי וחבר’ה שכיף לעבוד איתם. :)

המשרה כוללת בעיקר פעילויות הטמעה ויישום של MOSS 2007 ומערכות קשורות, ומתבצעת במשרדי החברה ואצל הלקוחות.
Omnisys Logo
   
רוצים להגיש קורות חיים? שלחו לי מייל (חובה לציין בנושא PS-JOB).
 
(הפניה מתייחסת לשני המינים :) )
How to check if a file exists over HTTP

Here’s a piece of C# code that determines the existence of a file over HTTP, given its URL. (Note that URLs should be encoded.)

try
{
    WebRequest request = HttpWebRequest.Create("http://www.microsoft.com/NonExistantFile.aspx");
    request.Method = "HEAD"; // Just get the document headers, not the data.
    request.Credentials = System.Net.CredentialCache.DefaultCredentials;
    // This may throw a WebException:
    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
    {
        if (response.StatusCode == HttpStatusCode.OK)
        {
            // If no exception was thrown until now, the file exists and we 
            // are allowed to read it. 
            MessageBox.Show("The file exists!");
        }
        else
        {
            // Some other HTTP response - probably not good.
            // Check its StatusCode and handle it.
        }
    }
}
catch (WebException ex)
{
    // Cast the WebResponse so we can check the StatusCode property
    HttpWebResponse webResponse = (HttpWebResponse)ex.Response;
 
    // Determine the cause of the exception, was it 404?
    if (webResponse.StatusCode == HttpStatusCode.NotFound)
    {
        MessageBox.Show("The file does not exist!");
    }
    else
    {
        // Handle differently...
        MessageBox.Show(ex.Message);
    }
}

As you can see, it’s fairly simple – we use the HttpWebRequest class to perform an HTTP request using the verb HEAD.

What is an HTTP HEAD request?

HEAD is similar to GET, only that instead of getting the file contents, we get just the headers. This is what proxies do to: When a proxy server gets a GET request for a URL it has in its local cache, it performs a HEAD request to the real server, to determine the requested file’s date/time stamp. If the file on the server is newer than the cached copy, the proxy will download it and cache it again, and of course – will serve the newer version to the client.

So how does this code work?

If the web request we perform will stumble into a non existing file, a WebException will be thrown: So we just need to catch the WebException and deal with it.

However, consider these two important notes:

1. Don’t assume any WebException indicates a 404 error, check its StatusCode, after casting it to a HttpWebException type. You might get a 500 Internal Server Error or a 401 Unauthorized response when doing web requests, so it’s important to check the error code.

2. As far as I checked, the HttpWebRequest might get redirected to a different URL, and you will not be notified of that. Some sites perform redirects to custom 404 pages instead of regular pages, and would give out a HTTP 200 OK code eventually, since they served the custom 404 page successfully. So check how that website behaves.

You’re welcomed to contribute your own ideas on how to improve this code. This is such a trivial task, yet I found almost no code samples for it online.

Dor Rotman.

How to get the context item in an SPD Workflow Activity

David Birin, a talented colleague of mine who also works at Omnisys, has just published a post about getting the context item in a SharePoint Designer Custom Workflow Activity.

This post is important for SharePoint developers since most samples you’ll find on the internet ignore this ability. Instead, their workflow activities ask the user to supply an item, while it’s obvious the relevant item is the current one, which the workflow is running on. (Even the ECM samples in the WSS/MOSS SDK have this issue.)

So go on and read it. :)

It’s David’s first post (not including the introduction one), so congrats and keep on posting good stuff. :)

 

Dor Rotman.

Quickstart Guide: Customizing Office 2007 Ribbons
הנה רשימה של מספר קישורים שהם חובה לכל מי שמעוניין לפתח יישומי Office 2007 שישתלבו לתוך ה-Ribbons:
 
החבר’ה ב-MSDN השקיעו רבות במאמרים מפורטים וברורים, במגוון נושאים בפיתוח Ribbons. בין הנושאים: איך להשתמש ב-Ribbon Designer של Visual Studio 2008, איך לייצר Custom Tab שמציג Actions Pane, וכן סקירה של ה-Object Model.
 
זהו מאמר (מסמך Word) המציין שיקולים ו-Best Practices לפיתוח ל-Office. כדאי מאוד לקרוא, הוא די קצר ונותן הרבה תובנות. 
 
זוהי רשימת כל האייקונים של Office, בהם אפשר להשתמש ב-Ribbons ובתפריטים.
מורידים את גיליון ה-Excel, פותחים אותו, ובלשונית ה-Developers ניתן למצוא כפתורים עם תפריטים קופצים המציגים את כל הסמלים.
לכל סמל יש ID משלו אשר ניתן להקליד לתוך מאפיין ה-OfficeImageId ב-Ribbon Designer של Visual Studio 2008 או לתוך מאפיין ה-imageMso ב-XML, במידה וכותבים אותו ישירות, לדוגמא ב-Visual Studio 2005.
 
זוהי רשימת כל ה-ID-ים של פקדים בתפריטי Office.
נשמע מיותר, אך למעשה זה שימושי מאוד: לרוב לא נרצה שה-Add-In שנכתוב ייכנס ללשונית “תוספות” שכולם שוכחים מקיומה, אלא נעדיף לשלב את הכפתורים שלנו בתוך אחת הלשוניות הרלוונטיות יותר, כגון "בית” (הלשונית הראשית) או “הוספה”. 
הפתרון לכך הוא קביעת הלשונית בה יופיעו הפקדים שלנו, וכן קביעת הפקד המדויק שלפניו או אחריו יופיע הפקד שלנו. זאת באמצעות המאפיינים BeforeOfficeId או AfterOfficeId ב-Ribbon Designer.


אם יש נושאים שמעניינים אתכם בפיתוח VSTO ואתם מעוניינים לקבל עליהם מידע, אשמח לשמוע בתגובות או באימייל.
דור רוטמן.
More Posts Next page »