How to enable anonymous access to InfoPath Forms Library SharePoint 2010

May 13, 2011 at 6:49 PM | Posted in SharePoint | 10 Comments

 

First of all the idea of enabling anonymous access to infopath forms on Internet sites  is not recommended at all , as it produce security risks. The anonymous access for infopath forms libraries in SharePoint 2010 is disabled by design of Microsoft SharePoint team , thus it’s not a bug it’s the correct behavior. But as you know sometimes requirements can be pain in the ass.  Don’t say I didn’t warn you.

First you need to follow more two steps to make this happen , first you need to change or let’s workaround the permissions of the library , then you need to add custom code to the infopath form submit button and deployment to InfoPath Services on central administration .

Change the permissions of anonymous users on InfoPath Forms Library :

If you go to the infopath forms library permissions and press on the anonymous ribbon button above you will see the following :

011411_0038_AnonymousSa3

011411_0038_AnonymousSa4

As you see that the delete, add , and edit checkboxes are grey and disabled. Thus first you need to copy the url of the popup page like this

011411_0038_AnonymousSa5011411_0038_AnonymousSa6

Copy the url and paste it on new tab in your browser and change the DOCLIB word with LIST like this

011411_0038_AnonymousSa7 

 

Now the add ,edit , and delete items will be available for checking . Check on add checkbox or/and edit .

011411_0038_AnonymousSa8

NOTE : if you go back to the library and click permissions and anonymous button you will still see the add, edit , and delete items grey and disabled and unchecked although you have checked them. That’s ok , as if you change the DOCLIB with LIST you will see you changes. No worries here.

Preparing you InfoPath form to write custom code with Server Administration :

Open you infopath form that will be available to anonymous users , go to options of the form.

image

 

Then select the “Secuirty and Trust” tab on the dialog , and uncheck the “Automatically determines Security Level “ and chose the last option “Full Trust”

image

 

Then go to the compatibility tab on the same dialog and make sure that the “Form Type” is Web Browser Form  then  enter your site url on the box of server validation and check the checkbox under it

image

The press ok for the dialog . Now we finished preparing the infopath for programming and custom code .

Write Custom code for the Submit button of InfoPath Form

Find your submit button and right click on it . Click the properties .

image

The button properties dialog will show up that contains several tabs . Make sure that you are under general tab , and the action selected is “Rules and Custom Code” . Then click on “Edit Form Code”  ( Please note that you need “Visual Studio toots for Applications” to be installed)

image

 

Then Visual Studio project will open for you and it will add the submit button event handler automatically. Your code will be added there but before this we need to add the SharePoint dll as reference to the project . Go to references of the project right click and add reference , popup will show up .Browse your files to the SharePoint Server 14 folder , and then go to BIN and chose the “Microsoft.SharePoint.dll” and add it to the project.

image

 

Now refrence the SharePoint dll on the above side of the class and put “using Microsoft.SharePoint;” . Now let’s go to the button event handler and write our code there , we need to add two lines of code

SPSecurity.RunWithElevatedPrivileges(delegate(){ this.Submit(); });

Now we added our code to the form it’s time to build our solution or visual studio project then close it.

image 

 

Now we are done with the custom code . Go back to the form and publish it to the Central Administration and activate it to your site collection and use the Form content type added and add the form to the library.

Note : Please make sure that the submit button have no “Sumit “ on it’s rules as the code will do the submit instead. If there is rule named “Submit” the custom code will not be executed.

You can go now and try the infopath form for anonymous users. It should work.

 

Don’t say anything to me if you have been hacked through this form , I warned you that it will introduce security risk .

 

Thanks,

Saed

10 Comments »

RSS feed for comments on this post. TrackBack URI

  1. amazing you … thanks alot

  2. Do you realy need to change the permision of the list if you use RunWithElevatedPrivileges?

    • I just ran into this today. Seems like you do not need to edit the list permissions when using RunWithElevatedPermissions. In fact, the list permissions change to allow AddItems did not seem to help at all. But the RunWithElevatedPermissions worked perfectly. Great solution!

  3. Regarding
    “enabling anonymous access to infopath forms on Internet sites is not recommended at all , as it produce security risks”

    Can you List the security risks which you mentioned above?
    I can only think of spam from anon user, which can be controlled, and not a significant security threat?

    thank you

  4. Is there a way to do this using VB.Net?

  5. did you already have a authenticode certificate? I am getting an error regarding that

  6. Hi Saed, thanks for this great post! A question: Do I need to configure the “Submit” options on the form ie Check the “Allows users to submit this form” box; “Send for data to a single destination; and setup the target forms library as the data source?

    Thanks
    Gary

  7. hi thank you very much
    but when come back and I change the DOCLIB with LIST again I cant see my changes and the add item is still unchecked and anonymous cant access to the form

  8. Thankfulness tto my father who stated to me on the topic
    of this website, this website iss actually awesome.

  9. {
    {��椮宿 {骼泌첿} ﮫ᪭ ⯫棠{|3|2|4} ઠ䭆桭㡭ṥ顭桮宮硨易艇寡 㡸槮 {޲繓왲婢鬮  㨣퀤|̨㶒㕇졣ώ, 沫桢㦡-|㬠妫텇곮ὢ졤欼柭㬠妫텇鸥 } 桡쯣䦰㥖ᬨ ⹠䅞﮲殲, 롪 㹬
    ﬥ讻ᬮ࡯퀫ﲼ ⹠{졡לּ㲶즥, 寱.

    |
    ݠ{欽 {ﳨ㬿 禫ᮨ㭾汦᳼ 
    믬㡲�殼 䖵櫰Ჭﱮ䖴묾콭졵ﱮ䖴 鲠
    |
    {̨�楫殭檷ᯠ礽 {ᮾ|멭衪졤맼衯ﭭ䁇䪮ᶠ{rss|rss ᥰ氽,
    믫쥇{⦱콭㡬盧} {ﳻ�绠㡸 {email|e-mail} {link|hyperlink} 鬨 {newsletter|e-newsletter}.
    ͮ箮 즠Ṩ 믭唿易촩³彲㡤鍩湨諸לּ {᳼⺠|椮㯰鳼|寣�{ 镖 ,
    鍇 ⹠᳼{«᤮塰⪂颮|Ƞ㡢᪠⬠䯤ᱥ컮
    |
    {Π}|Ю嶮怹椼ɤ桫蝓᭮㡫仠㱥嬿 ᣫ殨䡲ⴤ,
    査㹫껠⼲�ɱݠ�寱޽ 顽
    㯧{禫ὼ|濱�嬮穲�{믫얷୆繞즠{嬮禭騼饥軮 {î譮箮|ͮ禲 ⼲� {즠⺼泥} 鲠즤㡱檠‱�裂汨ᬻ?
    ݠ{|濱�릃⯫㲶㡡לּ㲮�
    |
    {Π掠勵繓妠콭祿㡫㡢}, 㦊믫얷졭{ⴤ|寫䯱汱|⬨硩㹎椽.
    ݠ{꽨贷骽 �᪼⬮⽮⨮�,
    沫桭毡 {ﲲ盧|} {嬮穲�믬殤ﲮ㦲㡬 {믫얶䭽
    {鮲汥|롲欼|퉧 {㦹樼汨ᬮỠ鬨 {嬮禭騼饥軮 {î譮箮|ͮ禲 ⼲� {즠⺼} 鲠佯ﲫ楳�瞲衯짥|ࡧᣥ餼ﳭﲨ �ݠ{|汥㡾欠랳|隭溥|溥 ⯫㲭鮴ﱬᷨ罬᳥ �
    |
    b{䖷欮|맼䱠 㦤氠{|�ᬮ⻠{拾|㯯|᫲�歳} �핦罬ੲ {魥|믭뱥 ࡤᮭ猪{⬮䤼쩷 ⬮䤼콭猪⬮䤽,
    䢆鳠顢査᰼ࡤᮭf㡵︥믬㡲�汨᪼喃嬮禭 塭|鮴ﱬᷨ쏬
    ݠ櫬 {閊⺥||ᳰﮥ泠{ݎ欥轷鳠软﫫ﮭ髮Ὧﲥ즩} ᣲﱱ믣졨 妩︥{㹒왾|䱠ᴷ{⬮䟼쩷졡쯣�柭�뫠}.

    |
    à啦䖳�嬮穫�뽯ﲥ퀬|ᥬ鮨쯭᫽ 㞲䩛⦆幠䩛 ƥ 妩鮲汥 {㥯ᬼ|���{溠㶒릂楠硢Ṩ {믬置长쩪绮
    |
    Ү푮 “ɧⱠ㡼 ࡧ᫫ᥪ绬 { 妩㩲㩲 ﷥ἠ鳨㮮} 㡸 {⬮⽱᪲|㦡-|ᣲﱱ멩
    |
    ˰ Υ믲ﱻ㡯㞲殼|㼷᪭棥�ﮪ졯塞渥 ݠ, 鲠꽱︨|㼭毠|ﰳ⬨믢᪽ �罯ﲲ镢鲨} {纬�᫦仠ﲲᬼ {汨ᬻ|塭} ﮨ {︥뱠ꮥ|汮왷�᭮ꡤ欥|㰮쮥} 㹰|
    а飥䱎欼㶒쉇졽ﳫ鸭·櫰Ჭ­⬮⽱᪲|㦡-|. ݠ{㯧㱠禿|衣퀤קּ涮粽 {�  Π嬠ᮨᥰ毠{ࡧ᫫ᥪ罢 “ɧⱠ㡼롪 尮欼}.
    ť桨 怒 {촷䅣欨騽 騬殨騭�痢 鸞㡨 寫穲㟻㥮퀲�᳼} {屳䩵 쿤樼﫰膓}
    |
    à 妩졦塾飠�ᮿ䩚} 㥊桲死 �{�㳮䬠�쯣� ϭ桯䉆 �飭㥖
    ﵮ. ؠ{︥볨桭汥ᬼ쭼 饥ᬼ ⡫᮱” 屠{㯱ɇᢨ쩲罳寡뽪ﭴﱲ猪鲯לּ询ᮨ�㮥䙦㩤﫼㩧 ᣫ퉚㩧衶馩} ݠ寫禭 ᳼, {㦪|ᣲﯽ 妫᩠{鳥콭棥|︥䲷欨믫氭᮲Ჲ鸥|䱠鶴買ᢠ汨ᬮꬠ{˰ﭥ |Ю졽|Ƞ 礽, 衣査︥�} {⼱|ﲲ}, Ⱡ {Ҡ|ɭ氠ުְ﫼ϯ池|Firefox}. {а森|ɱ묾콭´塾腫|а櫰Ჭ®쯣!
    |
    ޲쟻妩㥠|宮讠 {뱳衬渠|㰥퉦鯭ᬼ|Ჲ鸥} 饥査拾|} ⬮䯢. û 衲즠ﳮ{讠佢᧭ﲶ鑓ᬼ} {殲镎绠襥Ӡ衤汦᳼, 鳥 溥!
    |
    {ݠ쿡콼ͭ㡤檱欼㩲㩲⯦ὼñ㡫�㦹檠믲ﱻ㡢䉇〲�{䱠맼鯭ᬼ 妫ᦲ㬠{Ӡ롿 㦫髮즯|˰|ϲ쩷|Π禶ᴷ} ᫲ {㼤汦맼塭|ﳷ泭ﲲ绡 à�៻㯱·Ό騼︥䅣|䱠|汮욲Ჲ鸥|뱠|鳥콭¶᳥콭cݠ{㫫�ᮥ⡢骼衡 ᥰ毠㥂᫫ᥪ柠ѥ〲�㹠{|略镯飠 㦡-|飠⬮䤥 擄ﭭg|
    {а飥, 㦲驼Ůⱻ硤殼|֮䬠宿|ŮⱮ䬠㱥桱|u}! ˲쮲졨塯說鲷髮࡬囹 㥁MySpace|Facebook|Ê﮲᫲佒㩲 ᫠ᣲﱠ �{�柭�쯣�뫠} 桬痢桲 㞳|㨣퀭﷥�鳼} {롲欼|ﳫ鸭ﲮ᳥啅{᪼ﲲᣨ껠衪졤뱠桮〧᳥콭졯便쿱�魨  {а櫰Ჭ´᳥콭´桫鑣ﳰ禿轂欨믫氭´묾콭µ森|ϲ쩷} ⬮᪠{衬渠|뱠|⬥騼鳥콭¶鸭¶쩷|�欨믫氭·森} {�衩콤騠ꫠ桱}.
    |
    {а飥!|ŮⱮ䬠妭뙃᧬|ŮⱮ䬠㱥桱,|ީ,} 㹠泥 졲易{屮鮴ﱬ᳨㮮軠쉇즧 嬿 {᭮鳨�{崬ᬠ|쟼衢沲桱㯩  ⬮ᡢ ⬨硩㹪檬 �쭽 ᳼ {㼡ﯼ㩫鑞奄ﰰ楥쩲隮槤ogEngine/WordPress/b2evolution 柄rupal. Ю 䪃䅎 – ﭳ �婧᪭ 桱|婧᪭|汽, 롦泱祿鸠泱䞂לּ㹞Ჲ桡쯣 � 麳 {ᬼ|뱥᳨㮮佮蝓 ͮϮ {а鮮䥆㩭殨�住鳥} 螠{㯯|} , 㵾櫠⼫ !
    }


Leave a reply to coleman roadtrip grill lxe Cancel reply

Blog at WordPress.com.
Entries and comments feeds.