In a visual web part i'm getting list of group of current user. The user selects the necessary groups and presses a button save. After that assigns the rights to documents according to selected groups. How do I get the selected groups to assign permissions to a document? And how do I assign the rights to the just created document? Please help me. If there are examples show please.

2 Answers
2

New Event Receiver:
`
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using System.Web;
using System.Security.Permissions;
using Microsoft.SharePoint.Security;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.Workflow;

But when creating a document, event handler throws an error in a string:
HttpPostedFile file = _context.Request.Files[0]; error: "In an instance of Object reference not set to an object." What could it be? Help please.