بایگانی دسته بندی: InfoPath و 2007 // فرم سرور

آمار سریع: خواندن InfoPath XML به طور مستقیم از SPListItem در شیرپوینت

I’m been working on a project where I need to extract attachments from an InfoPath form. There are some good resources for parsing InfoPath forms (که فقط فایل های XML, پس از آن در واقع بسیار آسان است).

در حالی که من در حال ساخت پروژه, I started by downloading an InfoPath form and saving it to my local hard drive. My c# code was reading directly from that instance. اما, the InfoPath forms are really living inside a SharePoint forms library. I did a little half hearted searching to find out how to read it directly from the library and almost gave up, in which case I would have saved the form to a local temp directory and read it from there. اما, there’s no need to go through those hoops as you can read it directly from the library. This little snippet shows how:

/// چیزهای تعریف کلاس در اینجا, از جمله:
خصوصی SPFile mySharePointFile; /* بخشی از یک SPList */
// کد های بیشتر در اینجا و در داخل یک متد از کلاس ما می رود:
XmlTextReader textReader;
textReader = جدید XmlTextReader(mySharePointFile.OpenBinaryStream());

textReader.WhitespaceHandling = WhitespaceHandling.هیچ یک;

textReader.Read();

// اگر گره دارای ارزش

در حین (textReader.Read())
{

… and so on and so forth …

آنها کمی کلیدی بالا است که ما می توانیم InfoPath به طور مستقیم از طریق OpenBinaryStream به عنوان خوانده شده() method call on the SPFile as a parameter to the constructor on XmlTextReader. It works great.

</پایان>

مشترک شدن در وبلاگ من.

من در توییتر در http://www.twitter.com/pagalvin

برچسب ها:

برنامه نویسی استخراج فایل های پیوست از فرمهای InfoPath (از جمله نام خود را!)

I have an expense entry solution for a client that leverages InfoPath and workflow. At one point during the approval process, من نیاز به یک ایمیل است که همه از داده ها که InfoPath خوب و همچنین خود فایل پیوست برای تولید به طوری که (اه) someone can take that data and manually re-key it into an Oracle database application.

It’s not very difficult to get at or parse the InfoPath form. I didn’t know how to handle the attachments, اما. After an hour or two of poking around the Internets (an eternity!) I found this article: http://support.microsoft.com/kb/892730

It provide some handy code to extract the attachment from a node in the form. (You still need to find the node and all that, but that’s just XML parsing).

I know that the attachment is base64-encoded and I originally went down the path of just extracting the the base64 data, decoding it and saving it. اما, I quickly realized I didn’t know how to get the file name itself until I found the aforementioned article.

I had actually found that quite early, but I was put off by its split personality. On the one hand, the article *says* it’s good for InfoPath 2007. هنوز, the code and instructions are all about Visual Studio 2003 and references to InfoPath 2003.

خط پایین, the code that article provided is working well for me (تا کنون). I can get my InfoPath form, I can parse it, I can find and decode the attachment and I know its name. What more can one ask of one’s life?

</پایان>

مشترک شدن در وبلاگ من.

من در توییتر در http://www.twitter.com/pagalvin

If you’re worried that your SharePoint environment may be a tad unhealthy, let me help you fix that with a health check.

مدیریت گروه های تصویب با InfoPath در محیط زیست FBA

من هزینه فرآیند تصویب که من نیاز به پیاده سازی با استفاده از InfoPath در فرم های احراز هویت مبتنی بر (FBA) محیط زیست با استفاده از فرم های خدمات (InfoPath مبتنی بر وب).

دو گروه تایید وجود دارد و روند کار می کند مثل این:

  • کاربر پر کردن یک گزارش هزینه و آن را برای تصویب تسلیم.
  • That triggers an email to first level approver group.
  • First level approver reviews and approves or denies the report.
  • If first level person approves it, system notifies second level approver.

On the InfoPath side of things, I have different sections that hide/appear based on whether the user is a member of one of those approval groups.

In an FBA environment the username() تابع همیشه خالی برمی گرداند, متاسفانه. What I’ve done is set up a a custom list called “Approval Groups”.

من هیچ ستون های اضافی را به لیست اضافه کنید.

وقتی فرم باز می شود, آن دارای یک قانون مثل این:

image

"تعیین ارزش یک میدان" است که در اینجا:

image

این است که اساسا گفت:: پرس و جو گروه تصویب لیست های سفارشی و فیلتر است که پرس و جو با دنبال هر ردیف که در آن ارزش عنوان = "نوردیک".

در صورتی که هر مقدار را بر می گرداند, then the current user is a member of that group. I know it contains that value because the string length is greater than zero.

Close the loop by securing the individual items in the Approval Group list. At run-time, if the current user doesn’t have appropriate security access to that item then the query won’t return it, string-length will be zero and now you know the current user is not part of that group. You can use that fact as needed in the form.

This is a super brief write-up. I’m pressed for time or I’d provide more detail.

I don’t know how relevant it is that I’m in an FBA environment. This would probably work well in a non-FBA environment but I can imagine cases where this would be useful.

</پایان>

مشترک شدن در وبلاگ من.

من در توییتر در http://www.twitter.com/pagalvin

برچسب ها: ,

InfoPath و // یک توضیح برای "استثناء اداره نشده هنگام ارائه System.Xml.XmlException فرم است: پایان غیرمنتظره فایل در حالی که نام تجزیه رخ داده است. "

من امروز فرم InfPath مشغول به کار بود و در مقابل دوست قدیمی رو زد تا, "استثناء اداره نشده هنگام ارائه System.Xml.XmlException فرم است: پایان غیرمنتظره فایل در حالی که نام تجزیه رخ داده است. "

This happened to me a long time ago and I don’t know what exactly I did to resolve it. Honestly, من فکر می کنم که من تا به حال گذار به یک پروژه جدید و هرگز دیدم این یکی حل و فصل (جایگزین های من تا به حال برای مقابله با آن سردرد). I do remember it was a devil of a problem. I spent several unsuccessful days dealing with it. Since then, من دیده ام این آمده است تا در انجمن های MSDN حداقل یک بار در طول سال گذشته و هرگز واقعا دیدم یک پاسخ برای آن.

من آن را برخورد امروز و خوشبختانه این زمان , I had just made a change to the form. I backed out that change and the problem went away. It turns out that it’s possible to create a from template using InfoPath Designer in such a way that it generates a parse error on the forms server side of the fence.

در مورد من, مشکل را با این مراحل را باعث شد:

  1. اضافه کردن یک عنصر جدید به یک منبع داده ها به عنوان یک فیلد متنی.
  2. رها کردن آن را بر روی فرم.
  3. تغییر صفحه نمایش آن را به یک لیست کشویی.
  4. توصیه لیست کشویی به جلو و ارزش خود را از یک لیست سفارشی شیرپوینت.

من نمی دانم اگر این مراحل باعث مشکل و یا شاید, به نحوی اطلاعات در لیست خود یک مشکل است. I’m going to experiment a bit and see if I can nail downt he parameters of this with any more detail.

</پایان>

مشترک شدن در وبلاگ من.

من در توییتر در http://www.twitter.com/pagalvin

برچسب ها:

قراردادن یادداشت توسعهدهنده در داخل فرم های InfoPath شما

من هنوز در InfoPath جهان اشکال زندگی می کنند و من نیاز به یکی از این تغییرات "کوچک" به یک شکل است که, متاسفانه, breaks a naming convention I adopted with it two weeks ago. با خودم فکر کردم, "در این چیزی که کسی در حال رفتن به یک سال از هم اکنون و می گویند, چه پل تفکر بود? By Jove, his naming convention makes no sense!"

I realized that I could create a view on the form for this and then, once again, realized that I could have been doing something like this all along. I added a “Developer Notes” view to the InfoPath form as such:

image

I’ve configured the form so that users can’t get to that view and therefore, it’s only visible with the InfoPath client in design view. Now I feel a little inoculated against some future unknown developer looking at my form and thinking bad thoughts about me. Phew!

</پایان>

مشترک شدن در وبلاگ من.

من در توییتر در http://www.twitter.com/pagalvin

برچسب ها:

مدیریت InfoPath ها

من به نظر می رسد از طریق مراحل InfoPath که در آن بروید, از آبی, I’m crafting a bunch of forms. My fingers learn how to use the tool well and then I go through nine month drought and have to learn it all over again.

I’m in the middle of an InfoPath phase and I’m creating InfoPath forms with a lot of views. One thing you probably notice is that the InfoPath 2007 client shows views in alphabetical order. This is a real nuisance some times. My best technique these days is to prepend a number to the view name so that they always show in the order I want, as illustrated here:

image

I wish I had been doing this all along.

</پایان>

مشترک شدن در وبلاگ من.

من در توییتر در http://www.twitter.com/pagalvin

برچسب ها:

خدمات فرم InfoPath, تشکیل می دهد تایید بر اساس (FBA) و نام فایل منحصر به فرد

من مشغول به کار در برخی از InfoPath به شکل این هفته در MOSS در FBA محیط زیست و آموخته, وقتی که من رفتم برای استقرار فرمها را به عنوان یک محیط تولید با منطقه FBA که نام کاربری() function function does not work. I was using it to generate unique file names.

خوب, that function doesn’t work in an FBA environment (حداقل, not out of the box). و, upon reflection, using username in the way I had planned wouldn’t have guaranteed a unique file name in any event.

My solution was to use the now() function and a rule that fires on loading of the form. I assign the file name to data element when it’s blank:

image

image

The advantage of this approach is that the file name is set only once. (I don’t show it in the screen shot, but put a condition on the rule to only fire when “myFilename” is blank). I used to set the file name at the data source level. Typically, I would do something (بد) مثل این:

image

The problem with that is that if user A opens the form on Monday and the user B changes it on Tuesday, you’ll end up with two different forms since two different users saved it with different user names.

پس, as annoying as FBA can be in general and with InfoPath in particular, it made me re-think a small but really important technical detail and approach that I wouldn’t have done otherwise!

</پایان>

مشترک شدن در وبلاگ من.

من در توییتر در http://www.twitter.com/pagalvin

برچسب ها:

سریع و ساده: ایجاد یک فرم InfoPath و دفعات بازدید: فقط (فرمهای InfoPath و خدمات در خزه)

یک سناریوی کسب و کار رایج مانند این وجود دارد:

  • کاربر پر کردن فرم InfoPath.
  • تسلیم فرم.
  • فرایند گردش کار طولانی مدت لگد کردن.
  • در حالی که گردش کار در حال اجرا است, ما نمی خواهیم هر کسی که برای تغییر محتوای فرم.

This office.microsoft.com example describes how to create a separate "view" and mark the whole view as read-only. This is a workable approach but has the drawback that you’ve effectively created two entire versions of the same form and must now keep them in sync manually. If you add a field to the editable view, you must then add it to the non-editable view as well. Over time, with different developers, there can be some divergence.

This alternative might work better in some cases:

  • Add a new field to the form called "IsEditable".
  • Set its default value to true.
  • Promote it when publishing to MOSS.
  • در گردش, set the value of IsEditble to false.
  • Go back to the form.
  • Add a rule that "upon open of the form", disable your save button when IsEditable is false.

The drawback to this approach is that all the fields will still be editable on the screen. The user can get a false impression that they can actually change content. You can mitigate that by putting in some text that the form is disabled, possibly in big red letters across the top of the page.

In one project, I created a "workflow status" دیدن. As the workflow progressed, it would update specific status fields that had been promoted from the form. When the user opened the form, the "open form" rule automatically switched to that view and the user had a nice little summary status.

</پایان>

مشترک شدن در وبلاگ من.

تغییر نمایش بر اساس شناسه کاربر در فرم InfoPath

ما یک فرم InfoPath ایجاد شده بود با نمایش های مختلف برای حمایت از یک استخدام جدید / on-boarding process. When the company hires a new person, بخش فناوری اطلاعات و گروه های دیگر نیاز به اقدام (تنظیم حقوق و دستمزد, دسترسی به برنامه های کاربردی مناسب را فعال کنید, قرار دادن یک میز, غیره). We use on form but a different view of the form for each of those functions.

At this company, most of the people involved in the business process are IT-savvy, so when they access the form, their default view is a "menu" view with buttons that direct them to their specific function. اما, we needed to simplify things for the new hire’s direct manager. This person should not see any of the IT related stuff. در واقع, she should see just one view of the form and not even have an option to see the other views.

In our case, that direct manager’s account is directly tied to the form courtesy of a contact selector (which I am always wanting to call a "people picker" for some reason).

The steps are as follows:

1. In design mode, go to Tools -> گزینه های فرم -> Open and Save.

2. Select "rules".

3. Create a new rule whose action is "switch to view" and whose condition leverages the userName() تابع.

userName() returns the "simple" user name without the domain. If I log into SharePoint with credentials "domain\pagalvin", userName() returns "pagalvin".

The contact selector provides three bits of information for a contact. The "AccountID" portion is most useful for this scenario. The only thing that makes this even a little bit of challenge is that the contact selector (in my environment anyway) returns the domain and user ID, as in "domain\pagalvin". This prevents us from doing a straight-forward equality condition since AccountID ("domain\pagalvin") will never equal userName() ("pagalvin").

We can get around this using the "contains" operator: AccountID contains userName().

We can take it further and pre-pend a hard-coded domain in front of the userName() function to get our equality check and eliminate the risk of a false positive on the contains operator.

We would have REALLY like to automatically switch view for other users based on their AD security group membership. مثلا, when a member of the "IT Analytics" group accesses the form, automatically switch to the IT Analytics view. We didn’t have time to implement it, but my first thought is to create a web service that would have a method like "IsMemberOfActiveDirectorySecurityGroup", pass it the userName() and return back true or false. Does anyone have any other, more clever idea? Is there any SharePoint function we can leverage from InfoPath to make that determination?

</پایان>

برچسب ها: