none
Tfs 2017 binary image doesn't show RRS feed

  • שאלה

  • We have TFS 2017 and integration with API,

    we try to update the field description with the tag img with binary(png base64) src

    There are images that are not showen and there are images that are showen 

    this is our code :

      WorkItem workItemObject = tfsWorkItemRepository.GetWorkItem(id, defaultProject);

                        //For updating you need to open first
                        workItemObject.Open();

                        Log.DebugFormat("Updating WorkItem No. {0} with the following Params:", id);
                        foreach (KeyValuePair<string, string> item in values) {
                            Log.DebugFormat("Param Name: {0}, Value: {1}", item.Key, item.Value);
                            workItemObject.Fields[item.Key].Value = item.Value;
                        }

                        ArrayList errorList = workItemObject.Validate();
                        if (errorList.Count > 0)
                        {

                            StringBuilder builder = new StringBuilder();

                            foreach (Field err in errorList)
                            {
                                builder.AppendLine(string.Format("Field Name: {0}, Original Value: {1}, Error: {2}, Allowed Values: ", err.Name, err.Value, err.Status));

                                string allowedValues = "";
                                foreach (string val in err.AllowedValues)
                                {
                                    allowedValues = string.Concat(allowedValues, ", ", val);
                                }
                                builder.AppendLine(allowedValues);

                            }

                            throw new Exception(builder.ToString());
                        }
                        workItemObject.Save();
                        //For release all memory
                        workItemObject.Close();


    יום שלישי 29 ינואר 2019 14:47

תשובות

  • הי

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

    למיטב הבנתי, על מנת להוסיף תמונה ל- DESCRIPTION דרך API יש צורך במספר פעולות

    ראשית: להעלות את התמונה כ- attachment, שנית - להצביע על ה- URL שלה ב HTML TAG בתוך ה- description

    העלאת ה- attachment:

    https://stackoverflow.com/questions/963544/code-to-attach-a-file-to-tfs-work-item

    אח"כ יש לתחקר את אובייקט ה- attachment ולהשתמש ב- URL שלו

    ושוב סליחה

    דן


    דן

    יום ראשון 17 פברואר 2019 20:21
    מנחה דיון

כל התגובות

  • Good Day Adi,

    This forum is for Hebrew language. Please clarify if you need answer in English (in this case I will provide the link to the English forum) or you can manage the discussion in Hebrew


    signature   Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]    [Linkedin]

    יום רביעי 30 ינואר 2019 07:24
  • תודה על התשובה המהירה .

    יש לנו TFS 2017 ואינטגרציה עם API 

    אנו מנסים לעדכן את השדה description שמכיל בתוכו <img> עם src בינארי (png base64 )

    יש תמונות שמוצגות בטופס בהצלחה ויש תמונות שלא מוצגות וה img מגיע ריק (יכול להיות שזה קשור לאורך של ה src )

    זה הקוד שלנו :

    WorkItem workItemObject = tfsWorkItemRepository.GetWorkItem(id, defaultProject);

                        //For updating you need to open first
                        workItemObject.Open();

                        Log.DebugFormat("Updating WorkItem No. {0} with the following Params:", id);
                        foreach (KeyValuePair<string, string> item in values) {
                            Log.DebugFormat("Param Name: {0}, Value: {1}", item.Key, item.Value);
                            workItemObject.Fields[item.Key].Value = item.Value;
                        }

                        ArrayList errorList = workItemObject.Validate();
                        if (errorList.Count > 0)
                        {

                            StringBuilder builder = new StringBuilder();

                            foreach (Field err in errorList)
                            {
                                builder.AppendLine(string.Format("Field Name: {0}, Original Value: {1}, Error: {2}, Allowed Values: ", err.Name, err.Value, err.Status));

                                string allowedValues = "";
                                foreach (string val in err.AllowedValues)
                                {
                                    allowedValues = string.Concat(allowedValues, ", ", val);
                                }
                                builder.AppendLine(allowedValues);

                            }

                            throw new Exception(builder.ToString());
                        }
                        workItemObject.Save();
                        //For release all memory
                        workItemObject.Close();

    כשאנחנו מדבגים אנחנו רואים שהנתונים מהצד שלנו עובר תקין

    יום רביעי 30 ינואר 2019 09:19
  • תודה על התשובה המהירה .
    יש לנו TFS 2017 ואינטגרציה עם API 
    אנו מנסים לעדכן את השדה description שמכיל בתוכו <img> עם src בינארי (png base64 )
    יש תמונות שמוצגות בטופס בהצלחה ויש תמונות שלא מוצגות וה img מגיע ריק (יכול להיות שזה קשור לאורך של ה src )

    זה הקוד שלנו :

    WorkItem workItemObject = tfsWorkItemRepository.GetWorkItem(id, defaultProject);

                        //For updating you need to open first
                        workItemObject.Open();

                        Log.DebugFormat("Updating WorkItem No. {0} with the following Params:", id);
                        foreach (KeyValuePair<string, string> item in values) {
                            Log.DebugFormat("Param Name: {0}, Value: {1}", item.Key, item.Value);
                            workItemObject.Fields[item.Key].Value = item.Value;
                        }

                        ArrayList errorList = workItemObject.Validate();
                        if (errorList.Count > 0)
                        {

                            StringBuilder builder = new StringBuilder();

                            foreach (Field err in errorList)
                            {
                                builder.AppendLine(string.Format("Field Name: {0}, Original Value: {1}, Error: {2}, Allowed Values: ", err.Name, err.Value, err.Status));

                                string allowedValues = "";
                                foreach (string val in err.AllowedValues)
                                {
                                    allowedValues = string.Concat(allowedValues, ", ", val);
                                }
                                builder.AppendLine(allowedValues);

                            }

                            throw new Exception(builder.ToString());
                        }
                        workItemObject.Save();
                        //For release all memory
                        workItemObject.Close();

    כשאנחנו מדבגים אנחנו רואים שהנתונים מהצד שלנו עובר תקין

    יום שלישי 05 פברואר 2019 09:01
  • אהלן עדי,

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

    בקריאה מהירה של הבעיה, אני מנחש שהקשר קשור לאורך התווים של הקוד Base64 שאתה יוצר. תבדוק אם כל התמונות שאינן נראות הן אלו עם האורך תווים הגדול יותר, ואם כן אז אתה יודע היכן הבעיה ויכול להתמקד על הפתרון.

    יש מגבלה לדפדפנים לגבי אורך תווים ולפי התקן אתה לא יכול להעביר בשיטת GET ב URL אורך אין סופי,כך שגם שירותי API יפלו בנקודה זו. הניחוש הראשוני שלי הוא שהבעיה קשורה לכך אני מניח שאם השאלה הית ממוקדת בשרתי SQL למשל היית יכול לקבל תשובה מהירה בפורום המתאים בעברית, אבל אין לי ממש כוח להתעמק בכך כרגע. אני ממוקד יותר בפורומים שאני מנהל ובעיקר בתחום Data Platform.

    אתה מוזמן לשאול את השאלה במקביל בפורומים באנגלית שם יש פעילות מאוד גבוהה ותקבל תשובות מהירות מאוד
    תעבור על רשימת הפורומים בקישור הבא ותבחר את הפורום המתאים לנושא בצורה הטובה ביותר.
    http://social.technet.microsoft.com/wiki/contents/articles/34901.list-of-forums-by-languages-categories-and-field-of-discussions.aspx

    אני מקווה שזה פותר לך את הבעיה ואם לא אז לפחות מפנה אותך למקום בו תקבל פתרון :-)


    signature   Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]    [Linkedin]


    • נערך על-ידי pituachMVP יום שלישי 05 פברואר 2019 09:48
    יום שלישי 05 פברואר 2019 09:44
  • הי

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

    למיטב הבנתי, על מנת להוסיף תמונה ל- DESCRIPTION דרך API יש צורך במספר פעולות

    ראשית: להעלות את התמונה כ- attachment, שנית - להצביע על ה- URL שלה ב HTML TAG בתוך ה- description

    העלאת ה- attachment:

    https://stackoverflow.com/questions/963544/code-to-attach-a-file-to-tfs-work-item

    אח"כ יש לתחקר את אובייקט ה- attachment ולהשתמש ב- URL שלו

    ושוב סליחה

    דן


    דן

    יום ראשון 17 פברואר 2019 20:21
    מנחה דיון
  • אהלן דן,

    ציטוט: "יש תמונות שמוצגות בטופס בהצלחה ויש תמונות שלא מוצגות וה img מגיע ריק"

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



    signature   Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]    [Linkedin]

    יום ראשון 17 פברואר 2019 22:54
  • לא מכיר דרך אחרת, אלא אם כן מדובר בתמונות שכבר עלו לאתר כלשהוא והן זמינות ב- URL כלשהוא

    אם עדיין לא עלו, קודם יש להעלות אותן כמו כל attachment


    דן

    יום שני 18 פברואר 2019 07:09
    מנחה דיון