1
Answer

Automatic permissiom granted from custom list

Photo of Laurent Blanc

Laurent Blanc

10y
862
1

Hi!

I create an event receiver exactly like this link http://www.c-sharpcorner.com/UploadFile/40e97e/create-site-automatically-when-a-list-item-is-added/

but I don't know how to grant permission on the new subsite for users listed on Team Menbers fields in Custom List "Projects"
 
Can someone help me with code please
 
Thankss 

Answers (1)

1
Photo of Satyapriya Nayak
NA 53k 8m 13y

Attachment comboboxs.rar

Hi Nel,


Refer the below code and change accordingly as per your requirement.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace Comboboxs
{
  public partial class Form1 : Form
  {
  string ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["dsn"];
  OleDbCommand com;
  OleDbDataAdapter oda;
  DataSet ds;
  string str;

  public Form1()
  {
  InitializeComponent();
  }

  private void Form1_Load(object sender, EventArgs e)
  {
  comboBox1.Items.Add("Choose Color serial No");
  OleDbConnection con = new OleDbConnection(ConnectionString);
  con.Open();
  str = "select * from Color";
  com = new OleDbCommand(str, con);
  OleDbDataReader reader = com.ExecuteReader();
  while (reader.Read())
  {
  comboBox1.Items.Add(reader["ColorserialNo"]);
  }
 
  }

  private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  {
  comboBox2.Items.Clear();
  OleDbConnection con = new OleDbConnection(ConnectionString);
  con.Open();
  str = "select * from Color where ColorserialNo='" + comboBox1.Text.Trim() + "'";
  com = new OleDbCommand(str, con);
  OleDbDataReader reader = com.ExecuteReader();
  while (reader.Read())
  {
  comboBox2.Items.Add(reader["ColorpartNo"].ToString()); 
  }
  con.Close();
  reader.Close();
 
  }
  }
}



Thanks
If this post helps you mark it as answer
Accepted
0
Photo of Nel
NA 713 955.4k 13y
Thank you very much
0
Photo of Pravin Ghadge
NA 2.5k 358.5k 13y
Nel,

Just use foll lines in place of      conn.Open():
conn.Close();
conn.Open();